how to add files to jars META-INF
Solution 1
jar uf jarfile.jar META-INF/somefolder/somefile
Solution 2
You probably have the META-INF folder already when you create the jar from the source. Just put your files there before making the jar.
Solution 3
Try creating a META-INF
directory among the .class-files that you want to be included in the jar. Put whatever you want in this META-INF
directory, and it will be included in the compiled jar-file.
Solution 4
Rename the .jar
-file to something ending with .zip
, open it with an appropriate program, change what you want to change, save it and rename it back to .jar
. Jarfiles are Zipfiles.
Solution 5
From the jar documentation:
Updates an existing file jarfile (when f is specified) by adding to it files and directories specified by inputfiles. For example: jar uf foo.jar foo.class
evan
Updated on July 28, 2022Comments
-
evan almost 2 years
i want to create a jar file in which i want to place some file in the META-INF folder of the jar file.is it possible ? .i know how to create a jar file but clueless about how to put files inside META-INF
below is my desired jar files META-INF directory
META-INF > somefolder > somefile