1

Is it possible to take existing .class files and a MANIFEST.MF to create a jar file?

Is there a library that can create a "valid" jar-file? I tried it manually and it didn't work (using 7zip). ERROR: "Invalid or corrupt jar file"

If everything has been compiled before, it should (in my understanding) theoretically work, if you create a new zip file, put all the files in it in the original structure and then rename it to "jar".

My idea is to program something like this with java code. A solution where I could add a file to an existing jar, would also be ok.


If you're interested in why I want to use this, look at my initial question: Compile javacode out of a running java accpilaction - on a system that hasn't JDK installed

Community
  • 1
  • 1
codepleb
  • 10,086
  • 14
  • 69
  • 111

1 Answers1

0

Well Jar -cf

Try the jar command in $JAVA_HOME/bin

$JAVA_HOME is the path to you JRE/JDK installation

Puru--
  • 1,111
  • 12
  • 27