java: warning: source release 11 requires target release 11 Follow
I've recently updated the Intellij 2020.3.2 (Unlimited Edition),
- I've setup the project structure to 1.8 version.
- I have jdk 1.8
- I've make sure my compiler version is java 8.
But, I am getting "java: warning: source release 11 requires target release 11". Anyone help if I am missing something to configure?
Please sign in to leave a comment.
Is it a Maven/Gradle project? Do you have any configuration for the source/target versions in Maven/Gradle build files?
Yes, it is maven project. Even in Spring Boot initial project also got similar issue.
In addition, i can build project from console.
Did you create project using IDE Spring Initializr wizard? It would be nice if you can describe the exact steps how to reproduce, including the options you have selected in Wizard. Thank you.
>In addition, i can build project from console.
What JAVA_HOME is set in console?
- I've imported as maven project. File => New => Project from Existing Source and select the Maven project
- I've Environment Variable setup:
JAVA_HOME : C:\Program Files\java\openjdk1.8.0_261
JRE_HOME: C:\Program Files\java\openjdk1.8.0_261\jre
Thank you. Cannot reproduce this.
Could you please attach screenshots of
File | Project Structure | Modules | <module name> | Sources tab
File | Project Structure | Modules | <module name> | Dependencies tab
Settings (Preferences on macOS) | Build, Execution, Deployment | Compiler | Java Compiler
Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | Importing page?
Please also try version from https://www.jetbrains.com/idea/download/
Still not able to successfully build project. Intial issue gone. Now none of the dependency downloaded. Not able to connect to remote repository. I've setup "_JAVA_OPTIONS" environment variable for proxy settings.
I've enable the override local maven settings files as well.
Please provide IDE logs (Help | Collect Logs and Diagnostic Data action) after IDE restart and reproducing.
Do you have antivirus/firewall? Please check for solutions to try: https://intellij-support.jetbrains.com/hc/en-us/articles/360014262940
For uploading you can use https://uploads.jetbrains.com or any file sharing service.
I'm hitting the same issue using Win8.1, IDEA 2021.1.1 and SBT 1.2.8, when trying to use Oracle JDK 1.8.0_121 instead of the one packaged by JetBrains I'm getting:
Using SBT from command line directly works fine.
Also, I can't refresh SBT project structure - seems that `sbt-structure-extractor_2.12_1.0` is compiled with more recent JDK:
What JDK is set in Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | sbt | JRE?
Also, what JDK is set for the module(s) in File | Project Structure | Modules | <module name> | Dependencies tab -> Module SDK?
Andrey Dernov Once I change JDK to 1.8 in File | Project Structure | Project SDK, it's also changed for SBT and in module dependencies (both show it as "default" which I didn't override)
Could you please attach screenshots of JDK set in Project Structure for project, modules and sbt? Thank you.
And also the JDK for the Scala compiler server in Settings (Preferences on macOS) | Build, Execution, Deployment | Compiler | Scala Compiler | Scala Compile Server | JDK. Thank you.
I have the same problem and i resolved in Preferences > Java Compiler > Target bytecode version > 8:
What Language level do you have set in Project Structure | Modules | <module name> | Sources tab? Have you invoked Reload action in sbt tool window?
I cannot reproduce it sorry. If I have JDK 1.8 set for project and same JDK is used for sbt - project builds for me.
Please provide a sample project to check. Thank you.
Language level everywhere is set to 1.8 as well.
Stacktrace makes it pretty obvious that IDEA uses the sbt-jni compiled by the wrong version of Java.
Do you run IDE under 1.8 JDK? Can you provide all IDE logs and full error text? Thanks.
>Using SBT from command line directly works fine.
What JDK is used by sbt from the command line?
I had the same error message - turned out I had a library from a later version of Java included (but not used) in my project structure. Removing that cleared the message.
If your sure you have set what needs to be set, that is the settings under "File | Project Structure"
If your project is maven.
I suggest you "Reload Project" under maven, right click the project name->Maven->Reload Project
It worked for me, i was getting the same error after downgrading to java 8 from 9. Good luck
I had a similar issue and I fixed by overriding the following (I is a Maven project but I had to tell IntelliJ to use the proper settings):
In my case it was complaining about JDK 13 and I needed JDK 11.
Hope this helps someone,
I have been experiencing this issue intermittently when importing a new maven project. I've never found the cause, but invalidating the Intellij cache and restarting fixes the issue every time.
Please note that the JDK version that is set for modules in project must not be less than the language level configured for the module in Maven pom.xml. In latest IDE versions we have added a hint that would advise to ament language level or JDK version so that they were compatible.
If the problem still occurs despite that JDK is set correctly please report it to YouTrack with screenshots of the problem. Thank you.