• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Modifying existing jar file, how?

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1067
2
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic