Steve Cohen
Steve Cohen

Reputation: 4859

How do jar manifest classpath and -classpath command line option combine

If I have an executable jar X.jar, with a classpath defined in a manifest, and I want to include other jars on the classpath than these, will

java -classpath a.jar;b.jar;c.jar -jar X.jar

COMBINE these classpaths or OVERRIDE the manifest classpath in X.jar with the classpath specified on the command line.

(and if they will be combined, in what order will they be combined)?

Upvotes: 1

Views: 1252

Answers (1)

user207421
user207421

Reputation: 310979

They don't combine.

If you specify 'java -jar', the -classpath option is ignored, and the effective CLASSPATH comes from the manifest.

If you don't specify 'java -jar',the manifest Class-path is ignored.

This is all documented.

Upvotes: 3

Related Questions