Fix Java Error - Unsupported class file major version 63
When writing Java code - every once in a while when updating your JDK, JRE or project versions, you'll bump into an Unsupported Class File Major Version XX error.
This error can be frustrating and can prevent the program from running as expected. In this Byte, we will explain what this error means and how you can fix it.
The version itself, depending on the number, refers to the class file format, which is compiled Java code. When translated to JDK versions:
Java SE | Major Version |
---|---|
18 | 62 |
17 | 61 |
16 | 60 |
15 | 59 |
14 | 58 |
13 | 57 |
12 | 56 |
11 | 55 |
10 | 54 |
9 | 53 |
8 | 52 |
Fix Java Error - Unsupported class file major version XX
The Unsupported Class File Major Version XX
error indicates that the version of the Java class file that you are trying to run is not supported by the current version of the Java runtime environment (JRE) you have installed on your system.
In other words, the class file that you are trying to run was compiled using a more recent version of Java than the one you have installed.
JRE Mismatch
To fix this error, you need to update your JRE to the latest version.
Once you have updated your JRE, try running your Java program again. The Unsupported Class File Major Version 63 error should no longer appear, and your program should run as expected.
Dependency Mismatch
If you continue to encounter this error, it may be because your Java program is using a library or dependency that was compiled using a newer version of Java. In this case, you will need to update the library or dependency to a version that is compatible with your JRE.
If you're working on a Maven project, check whether the Java version in your pom.xml
file is set to a compatible version.
IDE Mismatch
If you're using an IDE such as IntelliJ Idea - in your settings, align the compiler level (language version), JRE and JDK versions.
Conclusion
The Unsupported Class File Major Version XX error can be fixed by updating the Java runtime environment to the latest version and ensuring that any libraries or dependencies used by the Java program are compatible with the updated JRE. By following these steps, you can successfully fix the error and run your Java program without any issues.