Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

java.lang.NoClassDefFoundError:

Status
Not open for further replies.

hottimbo

Programmer
May 10, 2002
6
0
0
GB
Having nothing but problems packaging applet class files and jarring them...

I have created a package of classes. When I dont jar them up and just reference them with the CODE="myclass.class" tag, everything is peachy.

When I jar them up however, it all goes pear shaped.

I set the ARCHIVE tag to "mypackage.jar", and have set the CODE tag to "myclass.class", "myclass", "mypackage/myclass" etc etc. The closest I get is 'java.lang.NoClassDefFoundError: myclass (wrong name: mypackage/myclass)'.

I've downloaded other peoples jar files containing classes, and can call them ok, and I'm now at a complete loss...


Thanks in advance.
Tim

 
Hi Tim,

That error sounds like your JRE cannot find the class it is calling. You have hidden the class in a jar file which is completely fine but you need to add the jar file to your runtime classpath. I know how to do that in an application environment where you go to a command prompt and add the following for example: /myDirectory/myJar.jar to your classpath where myDirectory is the full path of where that jar is residing and myJar.jar is the jar file in which that class that it is complaining about is residing. I am sure that running an applet has something similar to that but I don't know how to set up an applet's classpath. Look it up on google or in a Java book.

Regards,
Marwan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top