Can't compile java class in Intellij Idea due to "cannot find symbol class X" error
Try compiling the whole project (or at least class B
) first.
If you compile only class A
, class B
cannot be found because it hasn't been compiled yet (therefore, no bytecode B.class
file exists).
This is not intuitive, but true. IDEA doesn't automatically compile dependant classes when you compile single class.
"right-click on project -> compile"
This did solve the same problem for me.
Select Build -> Rebuild Project, it works for me!