[Java] Double-click to open jar file on Windows

less than 1 minute read

Open jar file on windows

When I made a jar file for distribution and distributed it, I could easily open it by double-clicking on Mac, but it could not be opened on Windows. Here’s how I made it work with a double click.

java installation

It will not start without java, so install free java8 according to the instructions. https://java.com/ja/download/

Edit Registry Editor

This is important. Search with regedit at the magnifying glass. Once opened, HKEY_CURRENT_USER/Software/Classes/Applications/javaw.exe/shell/open/command It moves like. Double click “(default)” and rewrite ““C:...exe” “%1”” as ““C:...exe” -jar “%1””. You can also use HKEY_CLASSES_ROOT/Applications/javaw.exe/shell/open/command.

Summary

At first, open the jar file from the program by right-clicking → select another program → always check this application… → Run with Java(TM) Platform SE binary. After that, you can move it by double-clicking.