Why can't eclipse resolve class in same package?

后端 未结 17 1855
逝去的感伤
逝去的感伤 2021-01-31 15:56

I hit F5 ~1000 times and restarted eclipse (also with -clean), deleted /bin, but nothing helps. Manually importing DoodleClient does not help. DoodleClient exists and is perfect

17条回答
  •  无人及你
    2021-01-31 16:23

    Compiler checks dependencies on compiled files, not on source code. So it means the compiler doesn't file DoodleClient.class. To check if you have the compiled class, open the Navigator view (Window -> Show View -> Navigator) and look for the directory that contains the .class files (usually bin/ or target/classes for Maven) and check if you have there DoodleClient.class file. If you don't you can:

    1. check the .classpath file to see if DoodleClient.java appears in some excluding attribute in some classpathentry (delete it from the exclusion attribute if it does)
    2. if you are using Maven check if DoodleClient.java appears in an tag in the pom.xml
    3. copy the necessary java files/packages to some other folder on your disk, compile DoodleClient.java manually from dos console with javac and then copy DoodleClient.class in your class folder in your project. Hope this helps.

提交回复
热议问题