0

I don't want to create a 'default manifest file', I just want to load the Manifest file(which I already created as per my requirements) into the JAR as it is. I used the command JAR uf, the MANIFEST.MF is not even loaded into the JAR. And then I tried JAR cvf, the MANIFEST.MF file was loaded with modified data(probably default manifest). What is the correct command to load MANIFEST.MF file into a JAR?

Also, the other files in JAR are .xml, .data, .properties which are all loaded successfully.

Jon Heller
  • 34,999
  • 6
  • 74
  • 132
Adharsh
  • 21
  • 8

1 Answers1

0

For Jar:

JarInputStream jarStream = new JarInputStream(stream);
Manifest mf = jarStream.getManifest();

From servlet its possible to use also:

try(InputStream in = servletContext.getResourceAsStream("/META-INF/MANIFEST.MF")) {
          return ....;
} catch (IOException e) {
    throw Throwables.propagate(e);
}
AntonZ
  • 136
  • 5
  • Thanks! I am looking for a cmd JAR command. Can you kindly help with that, if possible? – Adharsh Jul 24 '15 at 16:30
  • try from command line: `unzip -p app.jar META-INF/MANIFEST.MF` – AntonZ Jul 24 '15 at 16:43
  • @Adharsh is that you're looking for? – AntonZ Jul 24 '15 at 16:54
  • Sorry for the late reply @AntonZ. Thanks for that. But I was looking for a command to load a manifest as it is. Jar cfm worked for me. The manifest is loaded as it is without modifying it to be the default manifest. – Adharsh Jul 30 '15 at 05:52