Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error - "java: cannot find symbol" in IntelliJ IDEA

I want to run my project but IntelliJ IDEA version 13 shows some strange error message:

enter image description here

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?

like image 733
catch23 Avatar asked Mar 24 '14 21:03

catch23


People also ask

What to do if Cannot find symbol in Java?

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.

How do you fix Cannot find declaration to go to in IntelliJ?

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.

What does error Cannot find symbol mean?

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.


1 Answers

I believe the class is excluded from compilation - I think I've had this before.

Try: Settings -> Compiler -> Excludes

like image 105
Zyn Avatar answered Oct 07 '22 04:10

Zyn