Can't compile java class in Intellij Idea due to “cannot find symbol class X” error

前端 未结 6 912
暖寄归人
暖寄归人 2021-02-07 00:47

I created new Java module from scratch in my project. \"create \'src\' folder\" was selected in module creation wizard. There is single \"com\" package in source folder which co

6条回答
  •  终归单人心
    2021-02-07 01:04

    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.

提交回复
热议问题