tags:

views:

148

answers:

4

I have a jar file which is used in html file as applet. I want to modify the content of the jar file and to rebuild the jar file so that the html will work fine with the new jar file. How can i do this??

I already tried unzipping using 7zip nad modified the source and created the new jar. But when i use it in html it shows some java.lang.Classnotfound error

+1  A: 

You can unjar or rejar the classes and source files as you wish.

unjar

jar -xvf abc.jar 

jar

jar cf abc.jar input-files

http://java.sun.com/developer/Books/javaprogramming/JAR/basics/build.html

Yada
A: 

JARs are just ZIP files, use whatever utility you like and edit away!

Nick Veys
A: 

Disclaimer: When reverse engineering any code be sure that you are staying within the limits of the law and adhering to the license of that code.

Follow the instructions above to unpack the JAR.

Find the original source of the JAR (perhaps its on SourceForge) and download the source, modify the source, and rebuild your own JAR.

You can also decompile the class files in the JAR. This is a rather advanced process and has a lot of "gotchas".

Freiheit
A: 

Make the changes in the code (.java files), recompile to get the .class files. Then simply replace the old .class files in the jar with the new ones. I usually use WinZip, but you can use whatever app that can handle .Zip files. It should just work.

I've faced cases where the launcher of the app uses some sort of verification and checks for this kind of changes. I had to use a new launch script. This doesn't seem to be your case though.

tou