We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

NoClassDefFoundError in Netscape 3

boones
boones asked
on
Medium Priority
249 Views
Last Modified: 2010-04-16

I have a java application that works perfectly fine locally but when I try to execute the application from either the A: drive or the internet, Netscape gives me a "java.lang.NoClassDefFoundError:".

I have definitely uploaded all of the class components - so thats not it.  Does anyone know what this error message means or how to solve my problem?

Thanks,
Craig
boones@gis.net
Comment
Watch Question

Are you trying to load the applet into Netscape via a web server,
or are you directly loading the HTML page via the Open File.. dialog??

Author

Commented:
From msupinski: Are you trying to load the applet into Netscape via a web server, or are you directly loading the HTML page via the Open File.. dialog??

The applet works when I directly load the HTML page via the Open File dialog from the C:.

When I try to directly load the HTML page via the Open File dialog from the A: (yes, I have loaded all the class files to the a: drive) or when I try to load the applet into Netscape via a web server I get a NoClassDef... error in Netscape.

Craig Dubrule
boones@gis.net


Commented:
I suspect, this error has only one mean - ClassLoader on Netscape VM can not found the .class file, described in APPLET tag, so, something wrong with paths. Maybe, you HTML includes full path to class file, something like "C:\\...Something.class" ? So, your Java stuff is OK, possible error is in HTML. Check paths in tags.

Author

Commented:
They were good suggestions trof but they are not the answer. I double-checked what you said and it is not the case. The problem is definitely not related to the HTML file.
How are you mapping the address to your applet in the HTML form?

If you are not using a URL, it will not work.

For instance if the Applet tag says:

<APPLET code="A:\YourApplete.class">

or

<APPLET code="YourApplete.class">

you'll get into all kinds of trouble.

The second form will only work if both the HTML file and the applete exist on a Web serve and the first type must be changed to:

<APPLET code="file:///A|/YourApplete.class">.



Author

Commented:
JDK: In my HTML file I have my class reference setup as you have listed <APPLET code="YourApplete.class">. However, with this setup as long as the HTML file is in the same directory as the class file there should be no problems, right?

One additional point, my applet is comprised of 2 separate class files, one of which is an instance of the Applet class and the other is called by the first class.  This may have some effect on the answer. I have uploaded other single class file applets to the net before without a problem. Maybe the problem has something to do with this. Again, both class files and HTML file which calls the Applet derived class file are in the same directory.

Author

Commented:
Adjusted points to 200
All right, with the info you added I was able to duplicate your problem using the JDK fractal demo.

This behavior is only present in Netscape Navigator and does not appear in MS IE or Suns browsers.

To solve your problem you need to use the following syntax:

<APPLET CODEBASE="file:///A|/"  code="YourApplete.class">

Adding CODEBASE to the APPLETE tag instructs Java to search for classes in the specified directory.

Apparently, Netscape does not consider a floppy part of the . (dot) directory in the CLASSPATH environment variable, so adding CODEBASE is the only reasonable alternative.

As it turns out, its the only alternative! No combination of environment variable modifications will solve this one.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
By extensive browsing through the question database I was able to answer this question myself. I do appreciate all who tried to answer my question, I probably did not give enough info.

Anyways, the problem was that I was unaware that a single source code file that contains multiple class definition will compile into multiple class object files each one named with its respective class name.  I assumed that each source file would compile into an object file as in C++. This is not the case with Java.

Author

Commented:
JDK: I'll give you credit for this one - since you were the closest.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.