How can I fix unsupported class file major version 60 in IntelliJ IDEA?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
When working with Java projects in IntelliJ IDEA, you might encounter an error message that says "unsupported class file major version 60". This issue often arises due to a mismatch between the Java version you're compiling with and the version of the Java SDK that IntelliJ IDEA is configured to use. In this article, we'll explore why this happens, and how you can resolve the problem.
Understanding Java Class File Versions
Java class files are specific to the Java Virtual Machine (JVM) version they are compiled for. Each version of the Java language comes with a corresponding class file version. The compilation and runtime environments need to align with these versions to avoid compatibility issues.
Here's a quick overview of some major Java versions and their corresponding class file versions:
| Java Version | Class File Major Version |
| Java 8 | 52 |
| Java 9 | 53 |
| Java 10 | 54 |
| Java 11 | 55 |
| Java 12 | 56 |
| Java 13 | 57 |
| Java 14 | 58 |
| Java 15 | 59 |
| Java 16 | 60 |
The "unsupported class file major version 60" error typically occurs if you're trying to run Java 16 bytecode on a lower JVM version.
Resolving the Issue
Here are steps you can take to resolve the "unsupported class file major version 60" error in IntelliJ IDEA:
1. Check Installed JDKs
First, ensure you have the correct JDK version installed:
- Go to the Java SE Downloads page and download the appropriate JDK version (for major version 60, this is JDK 16).
- Install the JDK and make note of its installation path.
2. Configure IntelliJ IDEA to Use the Correct SDK
Next, configure IntelliJ IDEA to use the correct Java SDK:
- Open IntelliJ IDEA and navigate to
File > Project Structure. - Under the
Projectsection on the left pane, ensure theProject SDKis set to JDK 16. - Also, verify that
Project language levelis set to the appropriate Java version (Java 16 or above).
3. Update Module SDK
Some projects may have specific module SDK settings:
- Go to
File > Project Structure > Modules. - For each module in the project, ensure the
Module SDKis configured to JDK 16.
4. Clear and Rebuild the Project
Once the correct SDK is configured:
- Navigate to
Build > Rebuild Projectto clean and rebuild your project.
Example Configuration
Here's an example of how your pom.xml might look if you're using Maven, ensuring the compiler plugin is set up correctly:
Similarly, for Gradle, you can set the Java version in the build.gradle file:
5. Verify Environment Variables
Ensure that your JAVA_HOME system environment variable points to the JDK 16 installation path. Do this as follows:
- On Windows: Navigate to
Control Panel > System and Security > System > Advanced system settings > Environment Variables. - On macOS/Linux, you can add or modify
JAVA_HOMEin.bash_profile,.zshrc, or similar configuration files:
6. Revalidate Libraries and Dependencies
Sometimes, library or dependency mismatches can lead to this error. Ensure that the libraries or frameworks you're using are compatible with Java 16.
Conclusion
Encountering "unsupported class file major version 60" in IntelliJ IDEA is typically a sign that your project or build configuration is not compatible with the active JDK. By installing the correct JDK version, updating your project settings, and ensuring your environment variables are set correctly, you can resolve this problem and ensure smooth development within IntelliJ IDEA.

