Reputation: 3
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.
Upvotes: 0
Views: 486
Reputation: 259
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!
Upvotes: 1
Reputation: 8946
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.
Upvotes: 0
Reputation: 1252
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
Upvotes: 1