javamavenexceptionnetbeansexecutable-jar

A Java Exception has occurred


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.


Solution

  • Make sure your .jar files open with the correct Java runtime (preferably javaw.exe from JDK 24):

    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).