Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Eclipse, jars, and noClassDefFoundError

 
Karl Beowulph
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

I have a very simple program called HelloWorld. I can't seem to jar it up properly though.

.classpath


Manifest.mf


Jar contents
.classpath
.project
HelloWorld.class helloWorld\
HelloWorld.java helloWorld\
log4j.jar lib\
Manifest.mf meta-inf\

When I attempt to run the JAR I get the following:


The contents of HellowWorld is:


I'm not sure if this would have any effect, but my java version is not the same as what I'm using to build the project.



I'm using j2sdk1.4.2_12 as my library within the project. I've set JAVA_HOME to be "C:\j2sdk1.4.2_12".

Lastly, I'm building the JAR with Red Hat Developer Studio (Beta 1), though this seems to be a fairly common issue with Eclipse in general.

Can anyone offer any insight as to what I'm doing incorrectly?

[ December 12, 2007: Message edited by: Karl Beowulph ]
[ December 12, 2007: Message edited by: Karl Beowulph ]
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot put one jar file inside another jar file. You need to put the log4j jar file in the same directory as your jar file and then include it in the classpath setting in your manifest file.
See the manifest section of this for more information.
 
Michael Breuer
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To put a jar inside a jar there is a tricky solution with
onejar OneJar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic