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
A jar is just a ZIP file, so you can extract it with any archive manager like 7-ZIP. It will contain class files, which are compiled Java files. You need a Java decompiler to read and modify the bytecode.
Extract -> Decompile -> Add code -> Create Jar
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?