I haven't used Java for quite some time, and today I wanted to re-start using it. So I updated my IDE (IntellijIDEA) to 2019.1.3 version1, and I downloaded Java 12. Then I proceeded to uninstall my old Java 8 (and I deleted the folder with the SDK of Java 8 from my PC with Windows 10).
Then I opened IntellijIDEA, File -> Project Structure... -> Project -> Edit (Project SDK)
and there I selected the folder where I had just installed Java 12 (C:\Program Files\Java\jdk-12.0.1
). In the same window where I edited the SDK I set Project language level
to 12 - no new language features
.
Then I went to File -> Project structure -> Modules -> Dependencies
and I checked that Module SDK
switched to 12 - no new language features
. And indeed it did.
I clicked on Apply
and then OK
.
Then I went to File -> Settings... -> Build, Execution, Deployment -> Compiler -> Java Compiler
and I set Project bytecode version
to 12
.
I clicked on Apply
and then OK
.
I closed IntellijIDEA and shut down my PC. Then I turned my PC back on, I re-opened IntellijIDEA, I typed var
and IntellijIDEA told me: Cannot resolve symbol 'var'
.
I've found a lot of people with my issue by searching on Google, but none of them actually managed to resolve my problem. Here there are some question on Stack Overflow I've already read:
- IntelliJ IDE (Community Version) doesn't support var declaration Java 10
- IntelliJ IDEA no code completion for Java 10 'var'?
- problem in compile time when using "var" in jdk 11
- https://intellij-support.jetbrains.com/hc/en-us/community/posts/206967605-IntelliJ-does-not-recognize-java-symbols-
- Local Variable Type Inference not being recognized
- IDEA: javac: source release 1.7 requires target release 1.7
1
IntelliJ IDEA 2019.1.3 (Community Edition)
Build #IC-191.7479.19, built on May 28, 2019
JRE: 1.8.0_202-release-1483-b58 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0