Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

applet not showing in browser

 
john smith
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've written an applet using Netbeans IDE. It was loading fine in browser.

When I created a new package, and copied with refactoring (and also without refactoring) the same file into the new package plus the original html file also, and tried to load the applet again in the browser, it just doesnt load it. It says 'Loading java applet failed'

I've tried searching the forums, but was unable to find a similar prob. Any help much appreciated.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the applet is now in a different package, then you need to adapt the applet tag in the HTML file to reflect that.

If that's not it, check the Java Console for error messages.
 
john smith
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the response. Both the html and .class file are in the same location (ie. in the packageone package/directory).

eg. <applet code="MyMathsTester.class" width="800" height="400">

so they are in the same directory. Surely, it should pick up from here?

I've also tried

<applet code="..\packageone\MyMathsTester.class" width="800" height="400">
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surely, it should pick up from here?

No. The code attribute must be the fully qualified class name "packageone.MyMathsTester.class"

The "packageone" directory must be in the same directory that contains the HTML file.

<applet code="..\packageone\MyMathsTester.class" ... >

The code attribute is not a file name (so ".." or some such will not work), it is a class name; see above.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic