B4J Tutorial Running Jar with double click (in Java OpenJDK 11+ )

As shared in multiple places in this forum Java 11 OpenJDK does not allow to run jar files directly. (here)

Here is an easy workaround...

1. Run cmd with administrator privilege.
2. Type the following two commands:
ftype JARFile="c:\java\bin\javaw.exe" -jar --module-path c:\java\javafx\lib --add-modules javafx.controls "%1" %*"

assoc .jar=JARFile

Replace the path "c:\java\bin\javaw.exe" and "c:\java\javafx\lib" based on your installed java folder.

UPDATE 16/03/2023:

If you have OpenJDK version greater than 11 and you are still unable to run a GUI based jar then try edit in Registry
1. Navigate to Computer\HKEY_CLASSES_ROOT\JARFile\Shell\Open\Command
2. In Default put this value (replace path with your java and javafx lib path) :

"c:\java\bin\javaw.exe" -jar --add-opens javafx.controls/com.sun.javafx.scene.control.skin=ALL-UNNAMED --module-path c:\java\javafx\lib --add-modules javafx.controls,javafx.web "%1" %*

Last edited:


Active Member
Licensed User
Article updated to handle issues running Jar file for openJDK 11 and above for Jar files using javafx.web !