The moose likes Applets and the fly likes applet not showing in browser Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Applets
Reply Bookmark "applet not showing in browser" Watch "applet not showing in browser" New topic
Author

applet not showing in browser

john smith
Greenhorn

Joined: Jun 04, 2008
Posts: 14
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
Marshal

Joined: Mar 22, 2005
Posts: 35253
    
    7
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.


Android appsImageJ pluginsJava web charts
john smith
Greenhorn

Joined: Jun 04, 2008
Posts: 14
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
Marshal

Joined: Mar 22, 2005
Posts: 35253
    
    7
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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: applet not showing in browser
 
Similar Threads
configuring new clsid for MSJVM.
Image loading very slow from URL
Bad Magic Number Loading Portlet/Applet
Problem in loading package classes by AppletViewer
"Bad Magic Number" Loading Applet/Portlet