This problem is characterized by the use of Eclipse integration Maven development project, after executing the clean command, the original compiled results are cleared, and then in the edit, compile source code or run Times "XXX (Class) cannot be resolved to a type" error, Eclipse's Package Explorer window appears with a large number of red forks. This behavior is cleared by commands outside the IDE, and the IDE cannot find the compiled file.
The solution is to find the project-> build automatically in the Eclipse menu and make sure it's checked, and then click Project-> Clean ... menu command items, in the pop-up dialog to find the project, if it is a number of engineering dependent development, you can choose "Clean all projects", and then click the "OK" button. This process eclipse clears the. class file compiled in the project while recompiling the project (similar to the Rebuild feature in Jbuild).
We know that Maven can host the entire lifecycle of a project, and it participates in the entire series of validation, source control, compilation, testing, packaging, distribution, deployment (installation). The IDE can also do these things, so there will be repetitive but not intelligently collaborative actions, MAVEN clears the Eclipse compilation results, and Eclipse is clamoring for the Red Cross.
compilation on Eclipse always does not find the path to the class
Solution:
Windows->preferences->java->installed JREs->, add Tools.jar
or windows->preferences->java->installed JREs-> to use the JRE instead of using the JDK.
Or
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.6.0</version>
<scope>system</scope>
<systempath>c:/program files/java/jdk1.6.0_23/lib/tools.jar</systempath>
</dependency>