Solved

NoClassDefFoundError in Netscape 3

Posted on 1997-04-06
10
199 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
0
Comment
Question by:boones
10 Comments
 

Expert Comment

by:msupinski
ID: 1219440
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??
0
 

Author Comment

by:boones
ID: 1219441
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


0
 
LVL 1

Expert Comment

by:trof
ID: 1219442
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.
0
 

Author Comment

by:boones
ID: 1219443
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.
0
 
LVL 6

Expert Comment

by:jpk041897
ID: 1219444
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">.



0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:boones
ID: 1219445
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.

0
 

Author Comment

by:boones
ID: 1219446
Adjusted points to 200
0
 
LVL 6

Accepted Solution

by:
jpk041897 earned 200 total points
ID: 1219447
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.
0
 

Author Comment

by:boones
ID: 1219448
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.

0
 

Author Comment

by:boones
ID: 1219449
JDK: I'll give you credit for this one - since you were the closest.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sumDigits  challenge 7 60
firstChar challenge 13 84
Modeling a class in java 5 31
Eclipse Neon and jdk 1.8.0 11 66
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
The viewer will learn how to implement Singleton Design Pattern in Java.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now