Search code examples
javajar

How can I change manifest file in Java


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

enter image description here

I hope you understand, thank you :-)


Solution

  • You can do :

    jar cfm jar-file manifest-addition input-file(s)
    
    • The c option indicates that you want to create a JAR file.
    • The m option indicates that you want to merge information from an existing file into the manifest file of the JAR file you're creating.
    • The 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: