Meaningless Drivel is fun!
The moose likes Java in General and the fly likes Changing the JAR file contents in my lib folder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Changing the JAR file contents in my lib folder" Watch "Changing the JAR file contents in my lib folder" New topic

Changing the JAR file contents in my lib folder

Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196
Hi all,
I want to change some.hbm files (which are just text files) that are inside a JAR file. The JAR file is inside my lib folder inside WEB-INF (it is a library that my application uses).

Would it be possible to make these changes without unpacking and repacking the JAR? I tried to do it with WinZip but WinZip will not save the hbm file with it's same folder structure. When I click save it creates a new file with no folder structure.

Anyone have any suggestions on how I can do this?

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33124

If you are doing this from the command line, you can use the jar command. It has an update option described online.

Any reason you don't want to unzip the jar?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

If possible, it would be preferable to just regenerate the JAR file after changing the .hbm files in their permanent location. In other words, use your standard process for creating the JAR file.
Rob Spoor

Joined: Oct 27, 2005
Posts: 20276

If these files need to be modified more than once I wouldn't put them in an archive of any kind.

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Changing the JAR file contents in my lib folder
It's not a secret anymore!