问题
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
I export the jar as shown below making reference to the manifest file
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?
回答1:
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
来源:https://stackoverflow.com/questions/59145327/manifest-file-generated-inside-meta-inf-is-missing-classpath-reference