Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to compile my Java code on IntelliJ But I am facing following error Error:java: invalid source release: 8 in Java. So Here I am Explain to you all the possible solutions here.
Without wasting your time, Let’s start This Article to Solve This Error.
How this Error Occurs ?
I am trying to compile my Java code on IntelliJ But I am facing following error.
Information:java: Errors occurred while compiling module
Information:javac 7 was used to compile java sources
Information:03/02/19 07:35 – Compilation completed with 1 error and 0 warnings in 1 s 529 ms
Error:java: invalid source release: 8
How To Solve Error:java: invalid source release: 8 Error ?
How To Solve Error:java: invalid source release: 8 Error ?
To Solve Error:java: invalid source release: 8 Error First Of all Open your IntelliJ and navigate to File then select Project Structure Now select Project Settings (Ctrl + Alt + Shift + S). There will be Project SDK section Select the SDK that matches your code. My code targets Java 1.8, so I select Java 1.8. Then If you have a multi module project. Then Select the correct module SDK for each module. Go To File select Project Structure -> Modules -> Click on the module -> Dependencies and change Module SDK to Java 1.8. That’s it. Your project should run without problem now.
Error:java: invalid source release: 8
To Solve Error:java: invalid source release: 8 Error First Of all Open your IntelliJ and navigate to File then select Project Structure Now select Project Settings (Ctrl + Alt + Shift + S). There will be Project SDK section Select the SDK that matches your code. My code targets Java 1.8, so I select Java 1.8. Then If you have a multi module project. Then Select the correct module SDK for each module. Go To File select Project Structure -> Modules -> Click on the module -> Dependencies and change Module SDK to Java 1.8. That’s it. Your project should run without problem now.
Solution 1: Just Change Project bytecode version
Here Sometimes the problem occurs because of the incorrect version of the project bytecode. So That Just Change Project bytecode version. So verify it : File -> Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler -> Project bytecode version and set its value to 8. Now Your error should be solved.
Solution 2
- First Of all Open your IntelliJ and navigate to File then select Project Structure Now select Project Settings (Ctrl + Alt + Shift + S).
- There will be Project SDK section
- Select the SDK that matches your code. My code targets Java 1.8, so I select Java 1.8.
- Then If you have a multi module project. Then Select the correct module SDK for each module. Go To File select Project Structure -> Modules -> Click on the module -> Dependencies and change Module SDK to Java 1.8.
- That’s it. Your project should run without problem now.
Summary
It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?
Also, Read