Error: Class Compiled with Higher Java Version than Runtime
When executing scripts in Eclipse, users may encounter an error stating "Class has been compiled by a more recent version of the Java Environment." This issue arises when the compiled code targets a Java version higher than the currently installed Java Runtime Environment (JRE).
To resolve this issue, it's essential to verify the Java version of the compiled code and the installed JRE. In the given case, the error message indicates that the code was compiled using Java 9, while the installed JRE is Java 8.
To correct this mismatch, upgrading the JRE to version 9 is recommended. The table below provides a mapping between class file versions and corresponding Java versions:
Class File Version | Java Version |
---|---|
49 | 5 |
50 | 6 |
51 | 7 |
52 | 8 |
53 | 9 |
54 | 10 |
55 | 11 |
56 | 12 |
57 | 13 |
58 | 14 |
59 | 15 |
60 | 16 |
61 | 17 |
62 | 18 |
63 | 19 |
64 | 20 |
65 | 21 |
By upgrading the JRE to the appropriate version, the code will execute successfully without the mentioned error.
The above is the detailed content of How Do I Fix the 'Class Compiled with Higher Java Version than Runtime' Error in Eclipse?. For more information, please follow other related articles on the PHP Chinese website!