views:

114

answers:

3

Is there any software/script that will allow me to cd (change directories) into .jar/.ear/.zip files and edit the contents of the files it contains? I'm working on a large EJB project (yuck), and I frequently find myself in situations like the following:

something.ear/
|-- something.jar/
|   `-- fileINeedToEdit.xml

I work primarily via the command line (Mac/Linux), so I find myself decompressing the files with jar -xvf, editing the file I need to edit, and then recompressing with jar -cvf. Obviously, this becomes a major headache after the first few times.

I'd like to be able to treat the compressed files as directories, and simply cd (or some alternate command) to the file I want to edit.

Does anyone know how I can accomplish this?

+1  A: 

I agree with the comments to your question, an automated build should allow you to make this kind of changes easily and is the right way to go. But if you insist in this direction, check fuse-zip, it provides the ability for zip files to be mounted on any directory mount point.

Pascal Thivent
I had mild success using fuze-zip and overriding the `cd` command to mount with fuze-zip if the arguments were the proper type (zip|jar). However, the fact that changes to the mounted zip are not persisted until it is unmounted sort of threw a wrench in my plans.
Segphault
@Segphault: Can't say if this is the "normal" behavior. But I understand it's consequently not perfect.
Pascal Thivent
A: 

There are two general strategies. Either use software that can mount the jars as pseudo file systems. That allows you to work exactly like you are used to, but I'm uncertain how well Mac OS supports user-space filesystems. Or use a tool that already has in-place editing support, like the Windows explorer or a more powerful editor (e.g. emacs).

Kilian Foth
A: 

I use one of this application If I want to check something in jar or ear file

  • Krusader (file manager from KDE) - it allows to investigate jar, ear or war file, but unfortunatelly doesn't work well with nested jars files
  • mc (Midnight Commander) - it works pretty well with ear, jar or war, event with nested jars
Lukasz Stelmach