How Can I Fix “unsupported Class File Major Version 60” In IntelliJ IDEA?

The "unsupported class file major version" error occurs when you are trying to run or compile a Java code that is compiled with a higher version of Java JDK than the one used by IntelliJ IDEA.

To fix this issue in IntelliJ IDEA, you need to update your project’s JDK settings to match the version used to compile the code. Follow these steps:

  1. Go to the project settings by clicking on "File" in the toolbar, then select "Project Structure" (or press Ctrl + Shift + Alt + S).

  2. In the Project Structure dialog, navigate to "Project" in the left-hand menu.

  3. Under "Project SDK", select a JDK version that is compatible with the class file’s major version. If the required JDK version is not listed, you must download and install it first. You can download JDK versions from the Oracle website or use a package manager like SDKMAN.

  4. Click "Apply" and then "OK" to save the changes.

  5. Next, navigate to "Modules" in the left-hand menu of the Project Structure dialog.

  6. Select your project’s module from the list of modules on the right.

  7. In the "Dependencies" tab, make sure the correct JDK version is selected in the "Module SDK" dropdown.

  8. Click "Apply" and then "OK" to save the changes.

Once you have updated the JDK settings, IntelliJ IDEA should be able to compile and run your Java code without encountering the "unsupported class file major version" error.

About the Author Rex

I'm a passionate tech blogger with an insatiable love for programming! From my early days tinkering with code, I've delved into web dev, mobile apps, and AI. Sharing insights and tutorials with the world is my joy, connecting me to a global community of like-minded tech enthusiasts. Python holds a special place in my heart, but I embrace all challenges. Constantly learning, I attend tech conferences, contribute to open-source projects, and engage in code review sessions. My ultimate goal is to inspire the next generation of developers and contribute positively to the ever-evolving tech landscape. Let's code together!