MR AND
MR AND

Reputation: 406

Manifest file generated inside meta-inf is missing classpath reference

I am trying to generate jar file for the eclipse project using eclipse export jar feature. I am making absolute reference to a library in my manifest file

Manifest-Version: 1.0
Sealed: true
Main-Class: org.ad.TestMain
Class-Path: D:/demojar/commons-lang3-3.8.1.jar

I also tried with Class-Path: file:///D:/demojar/commons-lang3-3.8.1.jar and relative path like lib/commons-lang3-3.8.1.jar

My project structure is shown here enter image description here

I export the jar as shown below making reference to the manifest file

enter image description here

When I unpack my jar, manifest file generated under meta-inf folder does not contain classpath reference.The code complains about library not existing. How can I resolve this issue?

My main issue here is why classpath generated in the manifest file under meta-inf does not show the classpath referenced?

Upvotes: 0

Views: 1476

Answers (1)

Joe
Joe

Reputation: 1342

Remove the D: from the classpath and make the path relative to where your main jar is located

i.e)

folder/
folder/YourJar.jar
folder/lib/commons-lang3-3.8.1.jar

The manifest should be

Main-Class: org.ad.TestMain
Class-Path: lib/commons-lang3-3.8.1.jar

Upvotes: 1

Related Questions