Link to home
Start Free TrialLog in
Avatar of mahome
mahomeFlag for Germany

asked on

How to set classpath for jar in jar

Hello Experts,

I've created a jar with the content as you see below. A main class and required jars under lib folder.
In the manifest I included the required jars in the classpath.

But when I want to start application with: java -jar myapp.jar I'm getting the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/rpc/ServiceException

So it seems that jaxrpc.jar is not found and s.th. with the classpath is incorrect.
Please help me to correct my classpath.
jar content:
de/myapp/MyMain.class
META-INF/MANIFEST.MF
lib/jaxrpc.jar
lib/axis.jar
...

manifest:
Manifest-Version: 1.2
Main-Class: de.myapp.MyMain
Class-Path: lib/axis.jar lib/jaxrpc.jar ...
Created-By: 1.5.0_15 (Sun Microsystems Inc.)

Open in new window

SOLUTION
Avatar of ksivananth
ksivananth
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
take the jars out of the jar and instead put them in a lib directory with your application jar.
That should work (and makes it easy to upgrade the external jars without having to build a new jar)
Avatar of mahome

ASKER

Thanks for your fast help.
:-)