I tried to run my jar by double clicking on it but I got "A Java exception occurred", I also tried to run it via command prompt (cmd) and it worked, the program ran fine. I already have the Java(tm) Development Kit 24 (64-bit) and Java 8 Update 451 (64-bit) installed.I have already java(tm) se development kit 24 (64-bit) and Java 8 Update 451(64-bit) instaled.
Make sure your .jar
files open with the correct Java runtime (preferably javaw.exe
from JDK 24):
Right-click your .jar
file → Open with → Choose another app
Click "More apps" → Look for another app on this PC
Navigate to:
C:\Program Files\Java\jdk-24\bin\javaw.exe
Select javaw.exe
, and check “Always use this app…”
If jdk-24
doesn't exist, check where it's installed exactly.
This happens because when you run it thru cmd, you’re explicitly using the correct version of Java, but when your running it by double-clicking on it, you're use whatever javaw.exe
is associated with .jar
files, and that could be the wrong version (e.g., Java 8 vs Java 24).