Error:java: javacTask: source release 8 requires target release 1.8

Hobbyist picture Hobbyist · Apr 27, 2015 · Viewed 436.6k times · Source

Using IntelliJ IDE can't compile any projects. Screenshots of settings below:

Used JDK:

http://gyazo.com/b6e32119af7b04090d890cad04db6373

Project SDK and Language level:

http://gyazo.com/55a5fc9f7f2bb721a04780ce9d74eeab

Language Level:

http://gyazo.com/143bffad63fd89cafc231298729df2fc

Anybody have any ideas?

Answer

Weslor picture Weslor · May 29, 2015
  1. File > Settings > Build, Execution, Deployment > Compiler > Java Compiler
  2. Change Target bytecode version to 1.8 of the module that you are working for.

If you are using Maven

Add the compiler plugin to pom.xml under the top-level project node:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

(Hoisted from the comments.)

Note: If you don't mind reimporting your project, then the only thing you really need to do is change the pom and reimport the project, then IntelliJ will pick up the correct settings and you don't have to manually change them.