Run executable jar on double click on Windows

  sonic0002        2016-05-12 03:05:04       26,586        3    

Normally after installing Java, there will be an association between .jar and the javaw.exe. This enables the executable jar to be opened on double click. You can check the association by going to Control Panel -> Programs -> Default Programs -> Associate a file type or protocol with a program.

The default program of a file type can be changed in this dialog. However sometimes there are cases where the file association for .jar may be altered after a third party application installed. The executable jar may not be able to be started normally post that and it still doesn't work even after uninstalling the third party application.

Ideally, following steps can be followed to change the default program back to javaw.exe to run .jar file.

  1. Start "Control Panel"
  2. Click "Default Programs"
  3. Click "Associate a file type or protocol with a specific program"
  4. Double click .jar
  5. Browse C:\Program Files\Java\jre[version]\bin\javaw.exe or C:\ProgramData\Oracle\Java\javapath\javaw.exe 
  6. Click the button Open
  7. Click the button OK

If somehow this method doesn't work. You need to reinstall Java and then restart the computer and the problem should be resolved. 

Also, below command should always work and it can be put in a BAT file and then the batch file can be executed to invoke the jar.

java -jar [JAR_TO_RUN]

Hope this can help someone.

JAVA  WINDOWS  JAR  EXECUTABLE JAR 

       

  RELATED


  3 COMMENTS


Anonymous [Reply]@ 2021-11-01 03:40:56

how to shutdown the jar file if i activated it through double click

Anonymous [Reply]@ 2021-11-09 05:23:37

On modern Windows 10 the settings pane has been updated, it only allows you to select from either auto-detected nonsense/suggestions or select something from the Windows store...

Thiemooo [Reply]@ 2021-12-06 11:22:55

Thank you! Helped me solving my problem :)



  RANDOM FUN

Microsoft, do you have to do it like this?