IntelliJ - Error:java: release version 5 not supported

A common error in IntelliJ when attempting to run a new Java maven project is Error:java: release version 5 not supported.

Here are 3 techniques to resolve this. Try them in order. If one doesn't resolve the issue, try the next.

1. Update Java Compiler

  • Go to IntelliJ IDE menu item (or File on Windows) -> Preferences -> Build, Execution, Deployment -> Java Compiler

  • Delete value under Target bytecode version, then click OK

    IntelliJ - Error:java: release version 5 not supported_第1张图片

  • Refresh maven

    IntelliJ - Error:java: release version 5 not supported_第2张图片

  • Try running again. If problem persists, continue on to number 2 below

2. Update SDK Version

  • Go to File -> Project Structure -> Project Settings -> Project. Make sure you have the correct Java version selected. It should be the same as the one you downloaded

  • Also on this same panel, go to Platform Settings -> SDKs. Make sure you have the correct Java version selected

  • Click OK

  • Refresh maven

    IntelliJ - Error:java: release version 5 not supported_第3张图片

  • Try running again. If problem persists, continue on to number 3 below

3. Add property to pom.xml

  • Within IntelliJ, open pom.xml file

  • Add this section before  (If your file already has a  section, just add the  lines below to that existing section):

    
      1.8 
      1.8 
   
  • Change the x in 1.8 to your Java version. For example, if you’re using Java 13, change 1.8 to 1.13

  • Refresh maven

IntelliJ - Error:java: release version 5 not supported_第4张图片

  • Try running again

你可能感兴趣的:(java,开发语言,jvm,架构)