Reputation: 127
I am having a jar file. It contains .class and .java files. I need to make changes in the jar file and those changes should be reflected in the .class file. Is there any way to do the same. I am using Netbeans 8.0. I am not getting any correct way after searching a lot. Please help me with a solution.
Upvotes: 0
Views: 1151
Reputation: 240
You cannot just "edit" a class file (within a jar or not). At least not in a useful manner. You would have to recompile the class. You could replace the class file in the jar, but that can easily lead to problems (a coworker of mine once replaced a file in a jar which then didnt work at all anymore).
It's better to just repackage your jar. If it takes you more than 2 clicks or one command line call to clean, compile and package your project, you're doing it in an unnecessary hard way.
Using your IDE, or some build tool like ant or maven (both can do more than just build) it shouldn't be much of a problem for you to edit your java file and recompile and package the project.
Upvotes: 1