Skip to main content

Problems creating complex jar file

1 reply [Last post]
Joined: 2008-03-28

I am trying to create a jar file from a class file about 60 external jar files that have dependencies on each other.

Here is the sample of manifest.txt file (which has an extra blank line at the bottom):

<br />
Manifest-Version: 1.0<br />
Created-By: 1.6.0_01 (Sun Microsystems Inc.)<br />
Main-Class:<br />
Class-Path: lib/activation-1.1.jar<br />
 lib/annogen-0.1.0.jar<br />
 lib/axiom-api-1.2.5.jar<br />
 lib/axiom-dom-1.2.5.jar<br />
 lib/axiom-impl-1.2.5.jar<br />
 lib/axis2-adb-1.3.jar<br />
 lib/axis2-adb-codegen-1.3.jar<br />
 lib/axis2-ant-plugin-1.3.jar<br />
 lib/axis2-clustering-1.3.jar<br />
 lib/axis2-codegen-1.3.jar<br />
 lib/axis2-fastinfoset-1.3.jar<br />
 lib/axis2-java2wsdl-1.3.jar<br />
 lib/axis2-jaxbri-1.3.jar<br />
 ...<br />

# jar cvfm ../test.jar ../manifest.txt com/ lib/
# jar i test.jar
# java -jar test.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis2/Axis
Caused by: java.lang.ClassNotFoundException: org.apache.axis2.AxisFault
at$ Source)
at Method)
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

Weird thing is that if I "jar xf test.jar" so that the lib/ directory is exposed to java on the filesystem, it runs. It just doesn't know how to pull the lib directory out of the jar file?

Any suggestions would be greatly appreciated.


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-01-23

I have this same problem.. But for me the jar file is executing only in the location where I created that jar file.. To execute that in other locations I should carry that external jar files folder to the desired location..That means jar file that I created not including the external jar files..

Did you solve your problem?I tried
but its not working for me.