I have a jar file which consists of some java files, class files of those java files and some properties files. Now I need to make some modifications in those java files. I can extract the jar using 7 zip, can do the required changes in the java files and then saves it, but what about the class files? I have did some search regarding, but did not found any solution that works for me. Can anyone suggest me the steps needs to be followed to achieve this.
-
1you need to compile the java files then you zip it. – Sajan Chandran Jul 04 '14 at 11:19
-
jar gives you more options than 7zip – michael667 Jul 04 '14 at 11:35
3 Answers
Edit the java files, and as said above compile it, you are only editing the non-compiled version of your code.
Personally I use eclipse (which probably is the way to go for what you want) and it actually compiles everything back up together back into a .jar file.
eclipse is also a programming IDE so not only it compiles, but it edits your code too!

- 259
- 4
- 13
Edit the java file, compile the java file. Once it is successfully compiled and .class file is produced for the same, replace it with the old .class file and create a jar again.
Help on Compile See this How to compile a .java file in Java?
Help on creating a jar again (JAVA) Use Command Prompt to create .jar file from multiple .class files
I would recommend you to update the java files recompile it and regenerate the jar file with all the dependencies in it. Why to take unnecessary risk to corrupt the jar as it will waste both your time and energy.

- 8,806
- 4
- 29
- 34