I am trying to create a runnable jar of jars and classes.
In my build.xml file I have
After creating new jar it consist of *.class and *.jar files and if I want to run it I have an error
I saw that Eclipse adds to the manifest file
and the jar has classes from org.eclipse.jdt.internal.jarinjarloader package
If I add classes from org.eclipse.jdt.internal.jarinjarloader and update Manifest as above I can run my jar (but it's not a clean job). Can you tell me how can I do it without using classes from eclipse package?
Run
jar -tf your-jar-file.jar
and make sure that the list contains the class com.portal.pcm.EBufException in the directory com/portal/pcm . If it doesn't then you need to modify the 'include' set to make sure it gets included.
James Sabre wrote:Run
jar -tf your-jar-file.jar
and make sure that the list contains the class com.portal.pcm.EBufException in the directory com/portal/pcm . If it doesn't then you need to modify the 'include' set to make sure it gets included.
com.portal.pcm.EBufException is part of pcm.jar and this jar is included.
As I sad If I add to my jar *class files from eclipse and modify manifest as in first post everything works. The exception tells something about URLClassLoader and two classes from eclipse have Loader in a name.
Since you are trying to avoid using the Eclipse jar-in-jar class loader you cannot put the jars your main jar needs in the main jar. They need to be external to your main jar and, as I illustrated in my first post, you must define a Class-Path entry in your manifest. The entry is a list of jars separated by spaces.
Assuming that your dependency jar are external to the main jar and in the directory 'lib' relative to your main jar then your Class-Path entry will be