Schnee (schnee) wrote,

JAR file association fixing

A recent update of Nokia's do-stuff-with-your-phone application (needed to back the thing up, for instance) broke my Java applications (or at least easy access to them) by associating itself with JAR files. You'd think this is easily fixed (just reassociate them with java.exe or javaw.exe, as desired), but these tools expect the JAR file to be passed as an argument to the -jar option: javaw -jar ${JARfile}, not javaw ${JARfile}, and Windows, after 30+ years of development, is not yet capable of such arcane feats.

There's ways around this, but what you have to do exactly appears to be changing in each new version of Windows, and most of the older "here's how to do its" you'll find at the top of your search results will not, in fact work. So for the sake of saving y'all some headaches, the following worked for me in Windows 7 (hat tip to this guy):

  1. Put the following into a Regedit file (e.g. something.reg) and run it:

    Windows Registry Editor Version 5.00
  2. Open an Administrator commandline shell, and run the following commands:

    C:\>assoc .jar=jarfile
    C:\>ftype jarfile="C:\Program Files\Java\jre7\bin\javaw.exe" -jar "%1" %*

    Of course, be sure to use the correct path for your Java binary.

On a side note, the OVI suite also installs a Firefox plugin, so you may want to disable that as well.

Tags: java, useful stuff, windows
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded