I am using Intellij for coding java but the problem is it always displays
invalid source release: 9
every time. I know that in order to fix it is to go to the project structure and change the level from 9 to 8. However, every time I make a new module I have to change the module language level since the default is 9.
When compiling Java program in IntelliJ Idea
we might encounter the above error if the Java version is not properly set inside the editor.
Following the list of steps that you need to verify in order to compile your code correctly!
1) Go to File -> Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler
Here change the Project bytecode version to 1.8 or lesser. This changes the target release version.
2) Go to File -> Project Structure -> Modules -> Tab: Source: Language Level
Here change the language level to 1.8 or lesser. This changes the source release version.
3) Also, change the source release version to 1.8 by going to:
File -> Project Structure -> Project(In left pane) -> set "Project language level" to SDK Default (8 – Lambdas, type annotation, etc.)
Voila, now you are ready to start compiling your Java program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With