Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modifying a jar file

Tags:

java

eclipse

jar

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

like image 362
Andromeda Avatar asked Feb 02 '10 15:02

Andromeda


Video Answer


1 Answers

This is surely possible from the command line. Use the u option for jar

From the Java Tutorials:

jar uf jar-file input-file(s)

"Any files already in the archive having the same pathname as a file being added will be overwritten."

See Updating a JAR File

A brief test shows this quickly updates changes apart from trying to delete the file.

I haven't seen this answer on other threads about modifying jar files, and many, marked as duplicates, suggest there is no alternative but to remake the jar completely. Please correct if wrong.

like image 127
clwhisk Avatar answered Nov 08 '22 18:11

clwhisk