I have been working on a project with packages and can get it to compile and run using a plain old applet viewer, but when it comes to running it in a browser, I get the infamous java.lang.NoClassDefFoundError: pack1/pack1a/pack1b/ProjBase I have tried to reset the classpath thinking that could be it(working with Win 98) 'set classpath=d:\project1\pack1\pack1a\pack1b' That didn't work... So I took the ProjBase and combined it with another class in the same package(one that inherited from it). Then I got the same exception, now with the JApplet class. So I added the swingall.jar file into the classes folder of netscape...that took care of that problem, but then I received another no class def exception now for pack1/pack1a/pack1b/pack1c/ProjMainFrame I am lost...Sorry for the book I just wrote. Is there another way of fixing this problem??? Thanx Cardwell
The classpath should point to the top directory that contains the package directories. The classpath should NOT mention the package directories themselves. If the top directory is d:\project1 'set classpath=d:\project1' Then the package statements in the class file should be on the order of package pack1.pack1a and the class file that holds that statement should be in d:\project1\pack1\pack1a\whatever.class When you named the package directories in your classpath you confused the JVM.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Aug 16, 2001
Thanks for the reply... I went ahead and changed the classpath to the root most directory, and tried it...But the same problem occurs. I went ahead and tried it with every directory starting with d: upto ..\pack1b\ but still no luck.. I am sorry to be annonying... it is just that this has me stumped. Does it matter that I have two drives? Coperating system) d: project, netscape and jdk. It shouldn't as long as the class path is correct.? Could this be anything else than a classpath problem... What would be a good debugging technique for this... Thank you soo much for your help.. Cardwell
Joined: Sep 29, 2000
Did you actually check to make sure that the .class files are in the directory that their package statement promises? And if you are using an Applet what is your DocumentBase and CodeBase? Is your JApplet class actually sitting in the d:\project1 directory? Having two drives is not a problem, I run off the d: drive.
Joined: Aug 16, 2001
Thanks for taking the time html applet code = pack1.pack1a.pack1b.Proj width = 640 height = 340 PARAM name = properties value = "proj.properties" /applet the html page itself is in the root directory of the project. Proj.class is a class that inherits the ProjBase.class. Both of them are there in the directory...
[This message has been edited by cardwell cupp (edited August 16, 2001).]