This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError - Using a package in a Jar

 
Richard Butterwood
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I can run a jar file fine when I don't use a package, but when I add a package I get the NoClassDefFoundError. What should I be doing different when using a package?

Thanks,

Richard
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know how to execute a Java program with a class inside a package when the class is NOT packaged in a JAR file? If the class is in a JAR file, it is basically the same, except that you have to make sure the JAR file is included in the classpath. For example, if you have a class named Bar in a package called foo and this class is in a JAR file called foobar.jar, then you execute it as:

This assumes that you are in the same directory as the JAR file. If not, you can specify the complete path for the JAR file after the -cp option.

Layne
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic