Class Has Been Compiled by a More Recent Version of Java Runtime
- Java Version Numbers
- Resolve the Class Has Been Compiled by a More Recent Version of Java Runtime Error
The error message below shows the unsupported class version. It says the class file version is 63, and the current Java runtime can compiler the Java code until class file version 61.
Errors occur due to version mismatches, and we must update our Java runtime.
Java Version Numbers
Below, users can see the Java class file versions mapped to the JRE runtime versions.
Class File Version | JRE Runtime Version |
---|---|
49 | Java 5 |
50 | Java 6 |
51 | Java 7 |
52 | Java 8 |
53 | Java 9 |
54 | Java 10 |
55 | Java 11 |
56 | Java 12 |
57 | Java 13 |
58 | Java 14 |
59 | Java 15 |
60 | Java 16 |
61 | Java 17 |
62 | Java 18 |
63 | Java 19 |
In our case, the class file version is 63, which means we should run the file using at least Java 19, but we are currently using Java 17. So, the simple solution is to upgrade the Java version to 19.
Resolve the Class Has Been Compiled by a More Recent Version of Java Runtime Error
Download and Install the Upgraded Java Version
Users should follow the below steps to upgrade the JDK version in Windows operating system.
-
Users can download the recent versions of Java from the official website of Oracle.
-
After that, users need to install the newer version of JDK by clicking on the downloaded file. Once the installation finishes, we have to edit the environment variables and update the path for the Java home directory.
-
To set environment variables, search for the
environment variables
on the windows search menu and clickEdit System Environment Variables
. -
Users can see the dialog box opened on the screen. Click on the
Environment Variables
from the bottom right corner. -
Find the
JAVA_HOME
in theSystem variables
panel, edit it, and add the path of the upgraded JDK. If you don’t findJAVA_HOME
, click on thenew
button and add it. -
Now, users can open the command prompt, execute the
java -version
command, and see the upgraded version of Java. -
Next, try re-compiling the Java code, which gave the error. You will be able to resolve it now.
Change the Java Version in Eclipse IDE
If users use any IDE, like Eclipse, to compile and execute the Java code, they also need to change the Java version of the IDE. To change the Java version in the Eclipse IDE, users can follow the steps in the article Change the Java version in Eclipse.
Now, users can also compile the Java class 63 file in Eclipse, and it will be executed without any error.
In this article, we have solved the version mismatch error by upgrading the version of JDK.
Related Article - Java Error
- How to Fix the Error: Failed to Create the Java Virtual Machine
- How to Fix the Missing Server JVM Error in Java
- How to Fix the 'No Java Virtual Machine Was Found' Error in Eclipse
- How to Fix Javax.Net.SSL.SSLHandShakeException: Remote Host Closed Connection During Handshake
- How to Fix the Error: Failed to Create the Java Virtual Machine
- How to Fix Java.Lang.VerifyError: Bad Type on Operand Stack