can not be resolved to a type solution! ! !

Today we encountered a small building problem often encountered in time to make a Java project: XXX CAN BE resolved to not of the type A

When the time to see more than one hundred errors, small building and it was quickly scared to go degree of your mother.


Summarize the main ones being given such a small building in line to see the reasons :

1, jdk does not match (or not present) 

2, jar or packet absence of conflict 

3, eclipse finding items due to the type of policy 

The corresponding solutions are:

1, when jdk not match (or not present): e.g. jdk item specified as "jdk1.6.0_18", and the current is used eclipse "jdk1.6.0_22". Need BuildPath | do simple adjustments Libraries, the. 

2, when the jar package missing or conflict: When the jar package can not find "XX" is located, will be reported this wrong. This report will be wrong, you may need to adjust the package, unpack, choose delete In addition, the emergence of the same XX; just need to find the corresponding jar package can import the project.  
3, when the eclipse due to the type of policy to find items:  next eclipse, the above two have been compared, without any problem, but why this report was wrong. At this point, you need to operate at Project | Clean ..., the problem can be solved. The reason is due to the mechanism. Because some special reasons, eclipse not automatically compile the source code to build / classes (or other classes directory), can not lead to the type of look.


 

After analysis, the error is small building projects caused the second reason, eclipse could not find the corresponding jar package.

Thus, it introduced a small building corresponding jar package.

Specific steps:

(1)右键项目—>BuildPath—>Configure Build Path—>Java Build Path—>Libraries

 

(2)点击Add JARs...

 

(3)导入项目中libs下的相应的jar包

 

(4)导入相应的jar包后点击Apply

 

(5)最后错误就解决了。

Guess you like

Origin www.cnblogs.com/kangbazi666/p/12085070.html