Fix: UnsupportedClassVersionError: Unsupported major.minor version 63.0


Java Exception Stack Trace:

java.lang.UnsupportedClassVersionError: Main :
 Unsupported major.minor version 63.0

The Unsupported major.minor version error occurs when the Java runtime environment (JRE) is not able to run a Java class file because it was compiled with a higher version of Java than the one currently installed.

In this specific case, the "63.0" version number refers to Java 20, which is not supported by the version of Java installed on the system.


List of Java Major Versions

    Java Version Major Version
    * JDK 21 65
    JDK 20 64
    JDK 19 63
    JDK 18 62
    JDK 17 61
    JDK 16 60
    JDK 15 59
    JDK 14 58
    JDK 13 57
    JDK 12 56
    JDK 11 55
    JDK 10 54
    JDK 9 53
    JDK 8 52
    JDK 7 51
    JDK 6 50
    JDK 5 49
    JDK 1.4 48
    JDK 1.3 47
    JDK 1.2 46
    JDK 1.1 45

    Java JDK 21 is due to be released in September 2023.


Possible Fixes:

  • Recompile your source code with a lower version of Java that is supported by the current target system.

  • Or update the Java JDK version to the version (in our case JDK 20) on your target system.

  • If you're using an IDE like Eclipse or IntelliJ, make sure you have set the current versions in the module/project configuration.

To fix this issue JDK used to compile the Java code and the Java version is used to run the code must be compatible with the minimum Java version required by your target environment.


Fix the issue in Eclipse

  1. In Eclipse and navigate to the project that is causing the error
  2. Right-click on the project in the "Package Explorer" view and select "Properties".
  3. Click on "Java Build Path" and then select the "Libraries" tab.
  4. Check the Java version that is being used in the project's classpath.
  5. In the "Properties" dialog, click on "Java Compiler" and check the "Compiler compliance level" setting. Make sure that it matches the Java version used in the project's classpath.
  6. If the Java version used in the classpath is higher than the Java version used by the compiler, change the Java version used in the classpath to match the compiler version. To do this, select the Java version in the classpath and click the "Edit" button to change it.

After changing the Java version, clean and rebuild the project to ensure that the code is compiled with the correct version of Java and run the code again and check if the error is resolved.


Fix the issue in IntelliJ

  1. Open IntelliJ and navigate to the project that is causing the error.
  2. Right-click on the project in the "Project" view and select "Open Module Settings" (or press keyboard shortcut F3)
  3. Click on "Project Settings" and then select "Modules" and check the Java version that is being used in the project's module.
  4. In the "Project Structure" dialog, click on "Project Settings" and then select "Project".
  5. Check the "Project SDK" setting and make sure that it matches the Java version used in the project's module.
  6. If the Java version used in the module is higher than the Java version used by the compiler, change the Java version used in the module to match the compiler version. To do this, select the Java version in the module and click the "Edit" button to change it.
  7. Open Module Settings IntelliJ
    Project Structure - Module - Language Level
    Project Structure - Project SDK

After changing the Java version, clean and rebuild the project to ensure that the code is compiled with the correct version of Java and run the code again and check if the error is resolved.


Fix issue in VS Code

  1. Open VS Code and navigate to the project that is causing the error.
  2. Open the "Explorer" view in VS Code and navigate to the project's directory.
  3. Check the Java version that is used in the project's build settings or configuration files, such as the pom.xml file in a Maven project or the build.gradle file in a Gradle project.
  4. Open the project's build settings or configuration files and check the Java version used by the compiler.
  5. If the Java version used in the build settings or configuration files is higher than the Java version used by the compiler, change the Java version used in the build settings or configuration files to match the compiler version.

After changing the Java version, clean and rebuild the project to ensure that the code is compiled with the correct version of Java and run the code again and check if the error is resolved.

-

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


Author Info:

Rakesh (He/Him) is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. 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