How can I read (load) the java class from jar file, add some code to the class and then put back to the jar? I need to write a script (a java code) which does all these thin
The best solution would be to use the JAR in your code and extend the class (if the class allows you to do it).
If you can't, the JAR class is actually a ZIP archive. You can rename x.jar to x.zip and extract the content:
Here you have more informations (see especially OscarRyz's answer): How do you recompile a jar file?