• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Inserting into a jar file  RSS feed

 
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the best procedure for inserting a file into a jar file? I don't want to have to completely remove the jar file first.
Thanks!
 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul
Assuming you have a JAR file called MyApplication.jar and a file you wish to add to it called MyNewClass.class, type the following at the command prompt (assuming you are in the directory that contains them both):

Hope this helps
Michael
------------------
"One good thing about music - when it hits, you feel no pain"
Bob Marley
 
Paul Keohan
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks : this does help but is it normal for it to not overwrite the existing version?
If I jar uf myFile.jar myProgram.class
and there's already a myProgram.class in the jar file, I will now have two of them.
 
Michael Fitzmaurice
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, that's not normal - the expected behaviour is to overwrite. I have never experienced this behaviour before. Which platform are you using?
 
Paul Keohan
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NT - and it's happening with a class that has dozens of inner classes. So I end up with about 50 new class files added each time. At least this is what I see when I use winzip to view the results.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!