Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Modifying existing jar file, how?

 
Fernando Sanz
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tom Blough
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Fernando Sanz
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic