I've come across a couple of teams where at least one person is missing an easy to use jar viewing tool.
For one of these people, working on windows, he renames somefile.jar to somefile.zip and uses the built-in compressed folder viewer. Someone else, working on a mac, extracts the jar somewhere to see the contents.
I used to use WinZip for viewing jars, but the nagging to buy a license has driven me to look for an open source alternative - I now use 7-zip.
I don't know why there aren't more zip/jar viewing tools available - it seems such a simple thing that I thought I'd have a go a writing one in a few evenings and seeing how it went.
To get something written quickly, I've chosen Python as the language, wxPython for the GUI, Boa Constructor as an IDE with GUI builder (for wxPython GUIs), and py2exe to produce a windows executable so that whatever is produced can be easily used from Windows (via "open with" or by association with a "file type").
I tried Boa Constructor a few years ago. It's improved a lot - it's now really very good. It has code completion :-) If you want to put together a windows GUI quickly, it's free and works.
wxPython comes with demos - I found them great for working out how to do stuff. However, getting the (very simple) layout to work took much longer than I had expected.
I found it difficult to implement something satisfactory for "opening" a selected file from the zip/jar - ideas in a comment please.
py2exe is great - really simple to use. Unfortunately, the executables and associated files produced are often quite large - as in this case.
It's available from my often unavailable server under an MIT style license. To produce an executable version of the zip/jar viewer, install python, wxPython and py2exe and run "python setup.py py2exe" - that'll produce a folder called "dist" that contains the executable "ZippApp.exe" and associated files. If you copy those files to another machine, the executable can then be run without having to install python, wxPython or anything else.
To specify the zip/jar to view it supports:
- command line argument - to make the executable easy to use from Windows, e.g. "open with"
- drag-and-drop a file onto it
- typing the file path and pressing enter in text input
Double clicking on a file in the list executes "start" with the file name - a simple way to get an aappropriate application opened. This is currently implemented rather badly though - I couldn't work out how to do it better in the limited time I've spent on it. The problems with the current implementation are: sometimes you want to choose something other than what "start" will do to your file, and the current implementation leaves temp files lying around even after you've exited the application, for which I can only appologize as that's really quite horrible.
This code is around 150 lines (including code generated by Boa Constructor and the py2exe script) - quite short, so please have a read and tell me of improvements.
I haven't added any "extract" or "add" behaviour - I've just done what I wanted in order to see what it takes to write a jar/zip viewer. The missing features are "just work" and not so interesting from a learning point of view. If you add them, please post a link to your improved version.
I hope this little example is enough of a taster to encourage you to try writing a desktop application using the technologies featured.
From Mark Jenner:
Hi Ivan,
I just came across this on the Server side and thought it might help you with your Jar viewing post. Haven't tried it myself, but it sounds interesting, especially for digging into the gubbins of a and ear file.
http://www.theserverside.com/news/thread.tss?thread_id=40514
Posted by ivan at May 8, 2006 9:34 PMAs a free, fully-functional and extremely quick zip utility, I'm a big fan of filzip (http://www.filzip.com). It has a nice "explorer" view and, well, check it out.
Posted by: Dan North at May 9, 2006 10:00 PMI use TotalCommander to view all archives including jar files, all I need to do to come into archive file and browse it like any other folder is press Ctrl+PgDown. I even can change archive: add, remove or replace files without extracting archive. So, TotalCommander is realy commander for file system :)
Posted by: Zoran Milakovic at May 10, 2006 7:23 AMThis article was the missing link for my small project to quickly view the manifest.mf of a jar. Thanks!
Posted by: Larsh at May 10, 2006 12:11 PMIf you use the KDE desktop on *nix, the Ark archiver tool that they provide will work with jar archives.