Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij Gradle: 'cannot find symbol' for var - Java 11.0.4 [closed]

While trying to build my application using features from Java 11 (var), I keep getting the error message explaining 'cannot find symbol: var ex = new ClassName(); symbol: class var'

I'm using IntelliJ 2019.2.1 Community and Oracle Java 11.0.4, I have already tried this but it seems to be a solution for Maven, but not for Gradle.

I expect, since I set the JDK version to 11 and the Language Level to 11 to just work, but it doesn't.

like image 393
AwlsomeAlex Avatar asked Sep 06 '25 09:09

AwlsomeAlex


1 Answers

Add sourceCompatibility = '11' to your build.gradle file, and refresh gradle in IDEA.

like image 88
Max Farsikov Avatar answered Sep 10 '25 13:09

Max Farsikov