on 12-20-2006 4:35 PM
Hi.
I'm need to develop and run a batch java program. I'm having difficulty getting the application to find the 2 external JARs at runtime.
For compile time, I have physically imported these 2 JARs into the project. To add them to the build path, I selected "Add Jar". I now see the JARs in the project.
I've also update the Manifest file appropriately by adding this line.
Class-Path: com.sap.security.api.jar logging.jar
However, when running the program from the command line, I get class not found errors.
I noticed that the exported application JAR does NOT contain the needed 2 JARs even though they clearly exist under the project.
Am I going about this correctly? Why do external JARs not get included in the application JAR that is created? Can I somehow force them to be included?
Thanks,
Kevin
Hi Kevin,
why don´t you just add the two additional JAR files to the classpath at runtime:
java -cp x1.jar;x2.jar -jar yourJar.jar
This is the easiest way to start your Java app.
Have a look at <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/java.html">java - the Java application launcher</a> for details.
Regards Helmut
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kevin,
You cannot force them to include in the generated file. What you can do is, keep the external JAR files in system class path by using environment variable CLASS_PATH.
Regards
Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the information. I need a bit more detailed help for how to do this in UNIX system.
Just 3 more questions:
1. Do you mean that in the command line script, I need to run an initial command such as this?
export SHLIB_PATH=/usr/local/opt/myjar.jar
2. Does this impact the Manifest file. Do I still need to reference the jars there?
Kevin
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.