Executing jar file

hi,

it's basic question !!!!

i have the followin structure :

myApp

/lib/jar1.jar

/lib/jar2.jar

bin/com/package/main.class

bin/com/package/class1.class

bin/com/package/subpackage/class2.class

i would like to create a runnable jar file :

so i do an export from eclipse, i end up with a jar file with a manifest file not including the class-path information.

so i extract the manifest i add the following information :

Class-Path: lib/jar1.jar lib/jar2.jar

and finally i re-add the manifest file to the jar file.

when i run my app : java -jar myApp.jar , i have the following error, class not found org.apache.commons/.... this class belongs to one of my jar file located in the lib directory, i don't understand, perhaps i forgot something

thanks for your help

[859 byte] By [JAVA_USERa] at [2007-11-26 18:16:54]
# 1
hi,Your manifest should look like this :Class-Path: lib/Jar1.jar lib/commons-logging.jar lib/log4j-1.2.13.jar lib/Jar2.jar lib/Jar3.jar Main-Class: com.comany.project.MainClassI presume that you forgot the commons-logging entry.hth
java_2006a at 2007-7-9 5:50:29 > top of Java-index,Java Essentials,Java Programming...
# 2
I advice you to create your executable jar manually before using any tool.
java_2006a at 2007-7-9 5:50:29 > top of Java-index,Java Essentials,Java Programming...
# 3
So where do you place the external jars? I would expect the structure to bemyApp.jarlib/jar1.jarlib/jar2.jarNote - you cannot include the external jars inside your jar!
sabre150a at 2007-7-9 5:50:29 > top of Java-index,Java Essentials,Java Programming...
# 4

i forgot something, the jar files are loacted in the myApp folder

myApp

myApp/lib/jar1.jar

myApp/lib/jar2.jar

No i don't forgot the commons-logging.jar file,

here is the jar files generated

myApp.jar

/lib/jar1.jar

/lib/jar2.jar

/lib/commons-logging.jar

/lib/......

com/myClass.class

com/.....

META-INF/MANIFEST.MF

Manifest-Version: 1.0

Sealed: true

Main-Class: com.myClass

Class-Path: lib/jar1 lib/jar2 lib/commons-logging.jar

the lib/jar file are included in the generated jar, the manifest file include the class-path clause information,

i don't understand , why teh commons-logging.jar is not found!!!!

JAVA_USERa at 2007-7-9 5:50:29 > top of Java-index,Java Essentials,Java Programming...
# 5
can give me the command jar file to create manualy my packaged application in a jar format ?i mean "jar cvf ...." thanks
JAVA_USERa at 2007-7-9 5:50:29 > top of Java-index,Java Essentials,Java Programming...
# 6
go to bin directory where you should put META-INF/MANIFEST.MF and type :jar cvfm MyJar.jar META-INF/MANIFEST.MF *.*c: createv: verbosef: ?m: manifest
java_2006a at 2007-7-9 5:50:29 > top of Java-index,Java Essentials,Java Programming...
# 7
for your information the "class-path" clause does not work !!!!here is a link giving explanation : http://one-jar.sourceforge.net/
JAVA_USERa at 2007-7-9 5:50:29 > top of Java-index,Java Essentials,Java Programming...
# 8
it works fine for me. I have many jar application that work on Windows/Unix environment.By the way, did you add two line feed to the end of your manifest file ?
java_2006a at 2007-7-9 5:50:29 > top of Java-index,Java Essentials,Java Programming...
# 9

> META-INF/MANIFEST.MF

>Manifest-Version: 1.0

> Sealed: true

>Main-Class: com.myClass

> Class-Path: lib/jar1 lib/jar2 lib/commons-logging.jar

This looks wrong! Should it not be

Class-Path: lib/jar1.jar lib/jar2.jar lib/commons-logging.jar

Message was edited by:

sabre150

sabre150a at 2007-7-9 5:50:29 > top of Java-index,Java Essentials,Java Programming...