• Register
0 votes
712 views

Problem :

Using IntelliJ IDE can not compile any projects getting bellow error
error:java: javactask: source release 8 requires target release 1.8
6 5 3
6,930 points

Please log in or register to answer this question.

2 Answers

0 votes

Solution :

I fixed the issue just by changing target compile version to 1.8.

Please goto bellow path to change the target compile version to 1.8

File >> Settings >> Build, Execution, Deployment >> Compiler >> Java Compiler

Further Readings:

https://github.com/mccorby/FederatedServer/issues/2

9 7 4
38,600 points
0 votes

Solution:

  1. File > Settings > Build, Execution, Deployment > Compiler > Java Compiler

  2. Alter Target bytecode version to 1.8 of the module that you are performing for.

In case you are employing Maven

Include 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>

Note: In case you don't mind reimporting your project, then the just conceive you truly require to do is alter the pom and reimport the project, then IntelliJ will collect the right settings and you don't have to manually alter them.

This seems like the kind of error that Maven originates at the time you don't have the compiler plugin configured properly. Here's an instance of a Java 8 compiler config.

<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<!-- ... -->

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

<!-- ... -->

</project>

The quickest method I found:

  • First, Press:CTRL + SHIFT + A (For Mac ⌘ + SHIFT + A)

  • Then, type: java compiler

  • Lastly, press: ENTER

In the Settings window, fix the Target bytecode to 1.8

Like stated on the wiki page of the Apache Maven Compiler Plugin you can only fix the 2 properties employed by the plugin.

<project>
  [...]
  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>
  [...]
</project>

I solved this by going to Project Structure -> Modules, trace the module in question, click on Dependencies tab, alter Module SDK to Project SDK.

10 6 4
31,120 points

Related questions

0 votes
2 answers 173 views
173 views
Problem : Using IntelliJ IDE unable to compile any projects getting bellow error error:java: javactask: source release 1.8 requires target release 1.8
asked Oct 31, 2019 peterlaw 6.9k points
0 votes
1 answer 146 views
146 views
Problem : I am getting bellow error when running a JUnit test using IntelliJ IDEA error java javactask source release 1.7 requires target release 1.7
asked Nov 1, 2019 peterlaw 6.9k points
0 votes
1 answer 17 views
17 views
Does anybody have any ideas?
asked Dec 19, 2020 TeamScript 13.5k points
0 votes
1 answer 23 views
23 views
Solve this.
asked Dec 27, 2020 TeamScript 13.5k points
0 votes
1 answer 32 views
32 views
Problem: Hello Kodlogs, I'm trying to run my JSQL parser class, but I'm getting Error: java: invalid source release 1.9. I am all trying to understand and find the problem to fix the error. Could you please help me out to fix the error on my ... the solution. I found the forum helpfull and friendly that makes me posting and seeking help here. I look forward reading your comments. Thanks.
asked Jun 21, 2020 adamSw 11.3k points
0 votes
1 answer 28 views
28 views
How can I correct this?
asked Dec 28, 2020 TeamScript 13.5k points
0 votes
1 answer 29 views
29 views
Problem: My guess is that it's something related to Java 8 vs Java 7, but I have no idea what specifically.
asked Feb 15 TeamScript 13.5k points
0 votes
1 answer 6 views
6 views
Problem: who know this problem please help? javac: invalid target release: 1.8
asked Mar 25 Rohit kr 15.5k points
0 votes
1 answer 3 views
3 views
Problem: I need someone&rsquo;s help to fix it .. java 8 stream vs for loop performance
asked 5 days ago Ifra 24.4k points
0 votes
1 answer 47 views
47 views
Solve this error.
asked Dec 26, 2020 TeamScript 13.5k points