aspose file tools*
The moose likes Java in General and the fly likes Modifying existing jar file, how? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Modifying existing jar file, how?" Watch "Modifying existing jar file, how?" New topic
Author

Modifying existing jar file, how?

Fernando Sanz
Ranch Hand

Joined: Jun 27, 2003
Posts: 101
Hi there,
I have a problem trying to modify an existing jar file. When I want to create a jar file, I use something like:
REM build the application on windows, assuming the java/bin
REM directory is in the path environment variable
REM application is just the directory I am using
SET cp = c:\application\TestApp
javac -classpath %cp% TestApp.java
REM ****************************************
REM do packaging and adding manifest
REM ****************************************
jar cvfm App.jar manifest.mf TestApp*.class
REM ****************************************
REM run the jar file
REM ****************************************
javaw -jar App.jar

But now, I have an existing jar file (swingall.jar) and I want to modify a class within that file. So, I modified the .java file, and compiled it to get my new class file.
And the question is, how do I modify the existing file, so that I keep everything the same, except the modified class?
Thanks
Fernando
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

Huh?
Confusing question. You can just run your class file(s) if you want. If you want a jar file you need to recreate it everytime you change any code which lives in it.


Please ignore post, I have no idea what I am talking about.
Tom Blough
Ranch Hand

Joined: Jul 31, 2003
Posts: 263
Use your favorite zip compression utility - i.e WinZip or PKZip. Jar files are just zip files and packages like WinZip are much easier to use for replacing files within the Jar.


Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>
Fernando Sanz
Ranch Hand

Joined: Jun 27, 2003
Posts: 101
Originally posted by Tom Blough:
Use your favorite zip compression utility - i.e WinZip or PKZip. Jar files are just zip files and packages like WinZip are much easier to use for replacing files within the Jar.

I've just tried so, but it doesn't seem to work
In case this help to understand what I'm trying to do:
My idea was to modify the Swing package so that I could use it in my PDA. This way I could test the speed of my existing applications without having to rewrite the code to be compatible with Personal Java.
Thanks guys
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Modifying existing jar file, how?