-1

I compiled a class file and want to inject it into an existed jar file. I tried but "jar" command is not a good solution, anyone can help on this?

JerryCai
  • 1,663
  • 4
  • 21
  • 36

2 Answers2

0

so I think you can decompress the jar, and copy your class file in the directory you compressed. and re compress these files into a new jar file.

user1203650
  • 300
  • 2
  • 3
  • I also thought of this solution, but compare to inject a file to a existed jar, this way is risky. (Consider Manifest file, too big jar file, etc) – JerryCai Aug 30 '12 at 09:36
0

If you want to automate it in a script jar is your best bet. It's installed with the JDK and gets the job done.

If it's a one time operation you might want to use e.g. 7-Zip or another archiving software that can handle the jar file format (which is basically a ZIP).

Dude
  • 583
  • 2
  • 9