File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

appletviewer giving NoClassDefFound error

 
Karen Nelson
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Karen Nelson
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CODE="com\rephunk\PunnettApplet.class"


This should actually be CODE="com.rephunk.PunnettApplet.class" , because it is a class name, not a directory path.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic