Something has gone wrong and when you try to open an executable .jar file by double-clicking it, the file is not executed by the JVM like it should be (before), instead it’s opened by an archiver software like WinRar or WinZip.
You can still execute the file though by manually select the java launcher through right-click – ‘Open with’ menu, but that is not the proper nor the right way to do, and nobody wants to do it that way.
This problem happens because the .jar file association has been changed to open the archiver software. The .jar file itself is an archived file (jar stands for java archive), so, not surprisingly, most available archivers out there can open it, meaning they will display the full content of it (class file, java file, manifest file, etc.) instead of running it.
Now, we need to reset the file association for the .jar file so that the JVM will be one who opens and therefore launches the .jar file, not some archivers. In order to do that in Windows XP, follow these steps:
- Open Windows Explorer.
- Open Tools – Folder Options
- Open tab File Types – select ‘.Jar’ in Registered File Type List – click button ‘Advanced’
- select ‘Open’ in the Action list – click ‘Edit’
- Type into textfield ‘Application used to perform action’ the following line
”[JAVA_HOME]\bin\javaw.exe” –jar “%1%” %*
note: replace [JAVA_HOME] with your jre path (e.g. C:\Program Files\Java\jre1.6.0_03) and don’t forget to type the quotes.
For Windows Vista/7 users, you can’t do those steps through Folder Options because the tab File Types is not available on vista/7 no more. Yet, no need to worry, there is a free software from sourceforge.net called ‘Types’ which provides an alternative way to set actions for file types. This is a very lightweight application, its current version is Types 1.3.1 and only takes 155 KiB of your harddrive. You can download it at http://types.sourceforge.net/. Below is a snapshot I took from the the download link.