Fix: A Java Exception has occurred during Java Virtual Machine Launcher

Java Virtual Machine Launcher - A Java Exception has occurred

When you try to launch a Java jar application from the Terminal/Command Line and you get "A Java Exception has occurred", the most likely reason is that a Runtime exception or an Error has occurred when trying to execute the program.

How to fix Exception Occurred Issue

  1. Go to the console and see what exception stack trace you see and try to collect more information.

    The most common reason is that you are using a different version during running the Java application and you get an UnsupportedClassVersionError.

    Exception in thread
    java.lang.UnsupportedClassVersionError: Unsupported major minor version 63.0

    Another most common exception you will see is NoClassDefFoundError

    Exception in thread "main" java.lang.NoClassDefFoundError:
  2. Make sure that the Java version during executing the program is compatible with the application.
  3. It could be so that you are using 3rd party dependencies that are either not available during running the application or are properly configured.
  4. If you see a OutOfMemoryError: PermGen Exception you would need to increase the JVM memory allocation using the -Xmx parameter.
  5. Go back to your IDE and try to try running the application in debug mode to identify what has caused the exception.

Have Questions? Post them here!