JAR file association fixing

Jun 06, 2014 01:36



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
    [-HKEY_CLASSES_ROOT\.jar]
    [-HKEY_CLASSES_ROOT\SystemFileAssociations\.jar]
    [-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jar]



  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.

windows, useful stuff, java

Previous post Next post
Up