I have found some interesgting websites which have excellent java applets that explain physics theory. I could only view those webpages when attached to the internet, but then I learned I could download the *.class file related to the applet and then I would be able to open the webpage without being online.
The previous method has worked so far for many applets I wanted to save in my computer (to show them to my students in class), but there are some others I cannot get to work properly, even having the *.class file in the same directory where the saved webpage is. Do you have any idea of what is going on?

Few possibilities:

You don't have the html to run the applet.
The applet has one or more .class files and you don't have them all.
There's security contained in the applet(for example, checking to see that it is run from the makers domain).


I would say you don't have all the class files. With the larger applets I am sure there's more than one class. Without those extra classes, you wont be able to run the applets.

Few possibilities:

You don't have the html to run the applet.
The applet has one or more .class files and you don't have them all.
There's security contained in the applet(for example, checking to see that it is run from the makers domain).


I would say you don't have all the class files. With the larger applets I am sure there's more than one class. Without those extra classes, you wont be able to run the applets.

Thank you so much for your help.
The webpage only uses one *.class file, which is MagnusG.class, and the webpage is
http://www.rawbw.com/~xmwang/myGUI/MagnusG.html
I think the third option you give could be the cause of the problem. I used Class Editor to get the source code related to the class file, but I could not manage to disable the security, moreover it seems I can't determine what is the sentence related to the security.

Hmm. After looking at it I would tend to think it's in multiple classes. Is there an error you recieve while trying to run it? Down in the task bar(bottom right), look and see if there is a coffee mug icon. If there is, right-click on it and select show console. Copy everything it shows in the console.

I think there is more than one class file, but there's really no way to tell unless you have a look at the source code. Is there any way you can post it? If it's a lot then just attach it.

The error I get on the bottom right of the task bar is:

exception: java.lang.NullPointerException.

There is no coffe mug icon but I opened the Java Console and got this:
-----------------------------------------------

java.lang.NoClassDefFoundError: MagNCanv
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-4" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "thread applet-MagnusG.class" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NoClassDefFoundError: MagNCanv
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-11" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "thread applet-MagnusG.class" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

---------------------------------------------------------------

Thank you so much!
Now that I look at carefully the Java Console log, you are so right, the missing one was MagNCanv.class!
Dear friend, you are great!
Again, thank you!

This article has been dead for over six months. Start a new discussion instead.