Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

manifest.mf class-path not being read when executing jar file.

807580Feb 17 2010 — edited Jul 28 2010
I know I've used this in the past, but no I can't seem to get it to work.

I have an executable JAR file that has a manifest.mf in it with the following entries:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 14.3-b01 (Sun Microsystems Inc.)
Built-By: field
Main-Class: com.ims.survey.SurveyMain
Class-Path: lib/

What I am trying to do is have the classpath be able to read a lib directory that contains resource information (for localization).

When I double click the JAR file, it doesn't include the lib directory.

I've added a statement in the main method:
System.err.println("[debug] Classpath: "+_imsProps.getProperty("java.class.path"));

And this reports .\survey.jar

When I run it thru a bat file with
java -classpath .\lib\;.\survey.jar com.ims.survey.SurveyMain

it works fine, and the debug statement reports the directory correctly.

I've tried all kinds of variations of ./lib/ lib/ etcbut I never see it added to the debug statement when I run the the exeuctable jar file.

Any ideas?

It is like the executable JAR file will only run with the ./survey.jar in the clsas-path, ignoring anything in the manifest file.

I'm building the jar thru an ant script if that helps.. The target is create_run_jar.

Thx, Mark
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 25 2010
Added on Feb 17 2010
12 comments
4,566 views