Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating .class file in jar

Tags:

java

eclipse

jar

I want to update a .class file in a jar with a new one. What is the easiest way to do it, especially in the Eclipse IDE?

like image 644
penguru Avatar asked Nov 03 '09 12:11

penguru


People also ask

Can I modify .class file?

So the answer to your question is: it is almost impossible. Or you have to extract the source code to eclipse and try to generate another class file with your modifications.

How do you update a Java class?

To update Java routine classes: Deploy the new Java class or JAR file to the database server. The CALL SQLJ. REFRESH_CLASSES() statement forces the database manager to load the new class into memory upon the next commit or rollback operation.


2 Answers

This tutorial details how to update a jar file

jar -uf jar-file <optional_folder_structure>/input-file(s)      

where 'u' means update.

like image 73
Brian Agnew Avatar answered Sep 20 '22 12:09

Brian Agnew


Do you want to do it automatically or manually? If manually, a JAR file is really just a ZIP file, so you should be able to open it with any ZIP reader. (You may need to change the extension first.) If you want to update the JAR file automatically via Eclipse, you may want to look into Ant support in Eclipse and look at the zip task.

like image 21
JasCav Avatar answered Sep 22 '22 12:09

JasCav