I want to run my project but IntelliJ IDEA version 13 shows some strange error message:
Now class file has some small cross at class icon.
But this code was compiled, I couldn't figure out this strange behavior.
How to solve this trouble?
Output. In the above program, "Cannot find symbol" error will occur because “sum” is not declared. In order to solve the error, we need to define “int sum = n1+n2” before using the variable sum.
The reason IntelliJ couldn't find declarations was that the subprojects were not built. After investigating why subprojects were not built, I found out that using "auto-import" was breaking the subprojects. After importing the project from build. gradle without auto-import, it worked for me.
Any error that starts "cannot find symbol" means that the compiler doesn't know what that symbol (which can be a variable or a class name) refers to. In the second line of the error, where it says "symbol: class Scanner", that indicates that it doesn't know what the Scanner class is.
I believe the class is excluded from compilation - I think I've had this before.
Try: Settings
-> Compiler
-> Excludes
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