File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes appletviewer giving NoClassDefFound error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "appletviewer giving NoClassDefFound error" Watch "appletviewer giving NoClassDefFound error" New topic
Author

appletviewer giving NoClassDefFound error

Karen Nelson
Ranch Hand

Joined: Aug 19, 2005
Posts: 57
I have an applet which compiles fine, but when I try to view it using
the appletviewer, with the applet tag

<APPLET CODE="com\rephunk\PunnettApplet.class"
ARCHIVE="punnettjar.jar,c:\java\myclasses\kclasses.jar"
WIDTH=200 HEIGHT=100>

</APPLET>

I get a NoClassDefFound error for com/rephunk/GraphPanel. GraphPanel is the first class used from the kclasses.jar. I checked that it is in the jar file and it does have the package statement, and the kclasses.jar file is in the myclasses directory.

Any help would be greatly appreciated!

-Karen.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
So com\rephunk\PunnettApplet is in punnettjar.jar, and com/rephunk/GraphPanel is in kclasses.jar? I'm not quite sure if this is the problem, but not all classloaders like having classes of the same package split over several jar files. Try using just a single jar.


Ping & DNS - updated with new look and Ping home screen widget
Karen Nelson
Ranch Hand

Joined: Aug 19, 2005
Posts: 57
Now I have put all of my "generic" classes into a package (com.rephunk.myclasses), and kept the applet class out of the package. Appletviewer still will not show me the applet, with the same error message. If I make some manual changes to the applet file to allow it to run as an application, everything is fine.

Am I just missing something in the tag?

-Karen.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
CODE="com\rephunk\PunnettApplet.class"


This should actually be CODE="com.rephunk.PunnettApplet.class" , because it is a class name, not a directory path.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: appletviewer giving NoClassDefFound error
 
Similar Threads
bad class file error, compiling with packages
NoClassDefFound
appletviewer not showing applet
NoClassDefFound Error
NoClassDefFound Error in an Eclipse Export