Whenever I try to run my application from Intellij Idea I get the following error..
If I build the application via Maven it works fine.
Take a look at my module settings the JDK is v10, the language is v10 as well for both the project and module.
Any idea why this would be happening?
The “cannot find symbol” error occurs mainly when we try to reference a variable that is not declared in the program which we are compiling, it means that the compiler doesn't know the variable we are referring to.
The reason may be you are using an older version of java. In Java 10, the var keyword has been introduced. e.g. instead of doing String str = "Java" , you can now just say var str = "Java" .
The cannot find symbol error, also found under the names of symbol not found and cannot resolve symbol , is a Java compile-time error which emerges whenever there is an identifier in the source code which the compiler is unable to work out what it refers to.
The var keyword was introduced in Java 10. Type inference is used in var keyword in which it detects automatically the datatype of a variable based on the surrounding context.
I have no idea how this ever got set wrong but I had the Java compiler bytecode version settings set wrong in the IDE preferences...
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