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


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 while running the Java application and you get an UnsupportedClassVersionError.

    Exception in thread
    "main"
    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 run the application in debug mode to identify what has caused the exception.
Java Virtual Machine Launcher - A Java Exception has occurred

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap