The Source for Java Technology Collaboration
User: Password:



Ethan Nicholas

Ethan Nicholas's Blog

Integrate JAR files into your Windows desktop

Posted by enicholas on March 15, 2007 at 10:01 AM | Comments (12)

Dieter Krachtus just sent me a link to a project he's working on, a shell extension which allows you to treat JAR files as executable programs under Windows. Now, double-clicking on a JAR file has long caused it to be launched under "java -jar", but with the generic "Java document" icon it doesn't exactly scream "executable program". I'm not sure how many people even know that you can double-click on a JAR to launch it, and between that and the generic icon that probably explains why I've never seen a Java program which took advantage of that ability.

With the ability to embed multiple resolutions / color depths of icons directly into your JAR files, as well as Ant integration and a GUI, this looks like a nifty little project. It's currently limited by the fact that it has to be installed on the end-user's system to function, but... what if this sort of capability were integrated directly into the JRE? Is that something you would find useful?

It's also worth mentioning that, as a Mac user, I'm used to being able to "install" most applications by simply dragging them to my Applications folder or other convenient location, and "uninstall" them by dragging them to the trash. JAR files potentially represent the same capability offered to users of other platforms -- just download the JAR file, and that is the program, with no need to install it before using it or uninstall it when you're done with it. Just double-click on it to run it, and if you decide you don't want it anymore you merely need to delete it. I think there's quite a bit of merit to this idea.

Update: Sorry, I should have explicitly stated that Dieter does not work for Sun and this is not a Sun project -- it's just something I thought was neat. I should also mention that most of the credit goes to Chris Deckers, the project lead.


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • My first thought was, why do it as a separate project rather than as a part of JDIC? Is JDIC over and done with?

    Posted by: sumitkishore on March 15, 2007 at 11:15 AM

  • Well it's nice to see that Windows users will finally get what Mac OS X users have had since, oh, 2001? (double clickable app bundles)

    I did think however that we'd see self-contained Webstart-style jars - ie, the jnlp plus all associated resources in one jar, a bit like the Info.plist in OS X app bundles.

    Posted by: goron on March 15, 2007 at 11:24 AM

  • Looks cool. Something still seems missing, though. Maybe JAMs will help, but here's the deal: We need an archive format that has a lib folder (like wars) so other jars can be bundled. And it needs to have a file name extension separate from ".jar". It's as if Windows used ".dll" for executables. Just terrible. Call them ".jxe" or something.

    And for web (JNLP) apps, the other thing that's needed is a shortcut file that has _only a uri_ (or maybe some icon info?). That makes the system smarter even without browser extensions. And you can email them. Maybe could be ".jws" for "Java Web Start".

    So please, if Sun wants client-side apps easy to distribute, remember ".jxe" and ".jws".

    Posted by: tompalmer on March 15, 2007 at 11:42 AM

  • An ideal solution for me would be a shell extension that recognised a standard OS X app bundle. Windows would present it as a single entity (much like it does with zip files), read the icon/name/main jar info from the Info.plist, and have all resources within the bundle.

    Such a bundle, on Windows could wrap Java apps, batch files/powershell scripts, perl scripts, etc.

    A perfect solution would be for Windows to just die, of course ;-)

    Posted by: goron on March 15, 2007 at 11:51 AM

  • I agree, it is only a subset of apple's application bundles, but I always wondered why no other OS uses such kind. Hopefully, such thing gets a standard asap!

    Posted by: zero on March 15, 2007 at 12:35 PM

  • goron - My main beef with Mac app bundles is that they are pre-expanded dirs. (Maybe I'd have other beeves if I new the format better, but it seems to get the job done from what I've seen.) It's fine for local storage, if the OS understands them, but sending them around the world is a pain. Which is why you get dmg files, too.

    DMGs have the value-add of click-through licenses and clever backgrounds in their folders, but you can put click-through licenses in your own software if needed, and the backgrounds are a hack since they shouldn't be needed in the first place.

    Some kind of zipped app bundle would rock, though, and good point that it doesn't need to be Java specific. Maybe just zipped Mac apps (".zap"?) would be enough?

    Posted by: tompalmer on March 15, 2007 at 12:46 PM

  • @tompalmer - when you email a .app bundle on the mac, it arrives as a .app bundle - there's no mystery. transport should be separate.

    this reminds me of a time in the early 90s when i was tasked with assimilating some NeXT technology -- the team members would email directories and all was well. i was astounded.. how could you email a directory?

    seems natural now.

    unless you're stuck in Windows World :-(

    Posted by: goron on March 15, 2007 at 03:16 PM

  • This is a great work.It will be okay it after it has undergo some fine tuning,it should be integrated into some open source IDE like Netbeans.

    Posted by: yahaya2 on March 16, 2007 at 03:54 AM

  • Its great that you're still looking/working on this kind of deployment thing Ethan. In my opinion this kind of thing should be the focus of Java 7.

    There are 3 problems with jar files at the moment by the way:
    1. the webstart jnlp file needs to be included in it.
    2. we need to be able to bundle the jar files into one big one: vote for this top-25 bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4648386
    3. the worst problem: the WinRar & WinZip kind of programs steal the *.jar file-association after the JRE has been installed! I don't know if there's a solution to this problem :(

    How is the modular-JRE project going? Everyone's pretty excited about the idea of it and it'd be great to have a update!

    Thanks,
    Keith

    Posted by: commanderkeith on March 16, 2007 at 10:45 PM

  • Aside the DJ project, there is also a relatively old (2003?) shell extension project [3] from Peter Büttner. It's a simple DLL which enhance shell calls for jarfiles by returning version information, icons or tooltips from files inside the jar file. It's very simple to install (regsvr32 JarShell.dll) and use (just add a directory shell-meta-inf inside you jar file and write information inside version/description files and/or add an icon.ico).

    @commanderkeith: I fully agree about the 3 problems, the WinRar/Winzip problem is very annoying. As for jar file bundling, see [1] and [2].

    [1] http://fjep.sourceforge.net/
    [2] http://one-jar.sourceforge.net/
    [3] http://www.peterbuettner.de/projects/shelljar/

    Posted by: jmau on March 26, 2007 at 06:19 AM

  • In my opinion this kind of thing should be the focus of Java 7. There are 3 problems with jar files at the moment by the way: 1. the webstart jnlp file needs to be included in it. 2. we need to be able to bundle the jar files into one big one: vote for this top-25 bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4648386 3. the worst problem: the WinRar & WinZip kind of programs steal the *.jar file-association after the JRE has been installed! I don't know if there's a solution to this problem


    http://www.telecharger10.info/
    http://www.telecharger300.info/
    http://www.telechargerfr.info/
    http://www.telechargerplus.info/
    http://www.topfrancais.info/

    Posted by: caramollo on September 25, 2007 at 02:46 AM

  • There's an even easier way to achieve this, though it is really a hack. Add the registry entries below (replacing Path\to\your\javaw.exe with your Java install path), then create a .jxe file using the command:

    copy youricon.ico /B + yourjar.jar /B youjxe.jxe /B

    Then windows will display youricon.ico in Windows Explorer for that .jxe file, and double-clicking the file will launch the java app.

    This is because the registry DefaultIcon value '%1' tells windows to read an icon file from the start of the file, and the nature of zip (and by extension jar) reads from the end of the file, so joining the two together doesn't cause any interference.

    Registry:
    [HKEY_CLASSES_ROOT\.jxe]
    @="jxefile"

    [HKEY_CLASSES_ROOT\jxefile]

    [HKEY_CLASSES_ROOT\jxefile\DefaultIcon]
    @="%1"

    [HKEY_CLASSES_ROOT\jxefile\shell]

    [HKEY_CLASSES_ROOT\jxefile\shell\open]

    [HKEY_CLASSES_ROOT\jxefile\shell\open\command]
    @="\"C:\\Path\\to\\your\\javaw.exe\" -jar \"%1\" %*"

    Posted by: mhall on October 01, 2007 at 11:53 AM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds