Get your CodeRanch badge!*
The moose likes Beginning Java and the fly likes Eclipse, jars, and noClassDefFoundError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Eclipse, jars, and noClassDefFoundError" Watch "Eclipse, jars, and noClassDefFoundError" New topic
Author

Eclipse, jars, and noClassDefFoundError

Karl Beowulph
Ranch Hand

Joined: May 31, 2004
Posts: 130
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

Joined: Aug 05, 2005
Posts: 3169
    
  10
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.


Joanne
Michael Breuer
Greenhorn

Joined: Nov 18, 2007
Posts: 7
To put a jar inside a jar there is a tricky solution with
onejar OneJar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Eclipse, jars, and noClassDefFoundError
 
Similar Threads
Axis 1.4 Deployment on Websphere5.1 issue
The jar synchronization issue seems to be out of hand.
JUnit Test
JSTL Tag lib queries
Eclipse projects on removable media