Reputation: 177
How i can change class-path in mainfest file.
I have external jar file in folder:
Class-Path: folder/AbsoluteLayout.jar
I want to add my external jar file to my JAR MyProject.jar and change mainfast.. What should I write in mainfestu to link against the library into my jar..
Class-Path: path to my externalJar in MyProject.jar
I hope you understand, thank you :-)
Upvotes: 3
Views: 9111
Reputation: 351
Extract the manifest:
jar xvf MyProject.jar META-INF/MANIFEST.MF
Edit the manifest
Reinsert the edited manifest:
jar uvf MyProject.jar META-INF/MANIFEST.MF
If you encounter the manifest issue mentioned below by Pabasara, then try this approach
unzip -o MyProject.jar META-INF/MANIFEST.MF
sed -i "s/.*LOOK_FOR.*/REPLACE_WITH/" META-INF/MANIFEST.MF
zip MyProject.jar META-INF/MANIFEST.MF
Upvotes: 3
Reputation: 62864
You can do :
jar cfm jar-file manifest-addition input-file(s)
c
option indicates that you want to create a JAR file.m
option indicates that you want to merge information from an existing file into the manifest file of the JAR file you're creating.f
option indicates that you want the output to go to a file (the JAR file you're creating) rather than to standard output.manifest-addition
is the name (or path and name) of the existing text file whose contents you want to add to the contents of JAR file's manifest.More info:
Upvotes: 5