Solved

NoClassDefFoundError in Netscape 3

Posted on 1997-04-06
10
209 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to Alipay 10 95
Tomcat 9 + java 8 error while trying to deploy a war file 2 857
maximize the sum of fractions 33 76
Java regex 5 22
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

751 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