Applet wont load in browser

JDK: 1.1.6
Platforms: NT 4.0, HP-UX, Solaris

I have been working on an applet for several days, it compiles fine and runs great in the appletviewer, but when i place it on a webserver i cant load it in a browser.  I have been trying to use Netscape 4.05 for Solaris and NT, and IE 3.02 for Win95, with no luck.

I get this error in the Java console.
# Applet exception: error: java.lang.NoClassDefFoundError: TankTest
java.lang.NoClassDefFoundError: TankTest

The classes were compiled on the webserver, and eveyrthing is in one directory, so it should work fine.

Do I perhaps need to set my codebase in the html file?

In case you want to see for yourself:
http://www.umr.edu/~mfischer/tank/tanktest.html
mfischer2Asked:
Who is Participating?
 
gadioConnect With a Mentor Commented:
mfischer2, your problem is simple. You used the new event model (the java.awt.event.*). This package is not supported by the Netscape (I guess that you checked only on Netscpae right?). The IE4 does support the new model and you will find that your applet works there (nice little abrams image). What you should do is to move to the old UI event model, or restrict your users to IE4, or use the jdk1.1 patch for netscape (the best for the users is that you move to the old event model).
G.
0
 
fontaineCommented:
In the HTML you wrote:

<applet code="TankTest.class" codebase="/afs/umr.edu/users/mfischer/public_html/tank" width=500 height=500></applet>

I have the feeling that the codebase given is the local path, not the network path, what would
explain the problem. If the HTML file is in the same directory as the class files, you can
simply drop the codebase. I.e.:

<applet code="TankTest.class"  width=500 height=500></applet> is enough.

If the classes are not in the same directory, then you use the codebase attribute, that has
to contain a URL to the directory containing the classes. Here is a good explanation
about that:

http://java.sun.com/docs/books/tutorial/applet/appletsonly/html.html


0
 
mfischer2Author Commented:
I had no codebase earlier with the same results, i also tried
codebase = "."
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
mfischer2Author Commented:
I had no codebase earlier with the same results, i also tried
codebase = "."
0
 
msmolyakCommented:
Could you describe the directory structure on the Web server where the applet comes from. Indicate where the HTML file is located and wher TankTest.class is. Also specify what URL you use in your browser to access the HTML file.
0
 
drasinCommented:
You ought to try putting your applet code in the same directory as the HTML, and seeing if the applet will run then.  If it does, the issue must indeed be the codebase path.  Remember, the codebase must be accesible from the WWW, or the browser won't be able to run it.
0
 
mfischer2Author Commented:
The html file and the class files are in the same directory,
the html file is accessible according to the permissions and
that I see the file loading, but then fail.
0
 
msmolyakCommented:
Below are the messages reported by the browser when I tried to run your applet:

# Fetching http://www.umr.edu/afs/umr.edu/users/mfischer/public_html/tank/TankTest.class
# Applet exception: class TankTest not found

Note the URL the browser is using to read your applet class.

What if you use "codebase=http://www.umr.edu/~mfischer/tank" in your applet.
0
 
mfischer2Author Commented:
Tried that just now:
<applet code="tanktest.class" codebase="http://www.umr.edu/~mfischer/tank" width=500 height=500>

Heres what I got:
# Applet exception: class tanktest not found
java.lang.ClassNotFoundException: tanktest

I didnt get that path message that you got, but I have been changing the HTML during the day (just a few changes), so you may have looked at it then.
0
 
fontaineCommented:
Class names are case sensitive. tanktest.class is not the same as TankTest.class in Java...
My explanation still remains valid: you don't need the codebase as the classes and the
HTML are in the same directory.
0
 
fontaineCommented:
mfisher2's problem was the use of a local path for the codebase, as I mentioned in my
previous answer, combined, I have the feeling, with the fact that he refered to the class as
TankTest.class instead of tanktest.class (in the question, he talked about TankTest.class and about tanktest.class in the last comments) . With a browser that only supports the old event model, if the class is actually found, the message would be a java.lang.VerifyError because there is an attempt to use a java something package that is not known by the VM.
0
 
mfischer2Author Commented:
Thanks alot, that fixed it. (using IE 4.0)  I guess its my fault for not reading more beforing un-deprecating my code.  (about tanktest and TankTest for the curious, TankTest was there to try and fix it, tanktest was the real version that was uploaded later, thats why the change).  A quick follow-up, should I undeprecate or wait for Netscape to catch up?
0
 
gadioCommented:
I would recommend you to use the old event model (that would cause you to get 'deprecation' warnings during compilation), because its not so attractive to force your users to use IE4. And its not too dificult to work in the old model. I dont think that you can wait for netscape to catch up since their plans and time tables are quite vage.
G.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.