eclipse The import junit cannot be resolved

   我们在做Junit单元测试时,导入import org.junit.Test包时,有时会提示" The import junit cannot be resolved  ";

   出现这种错误可能有这两种情况:第一种情况:需要导入JUnit

                                                          第二种情况:JRE的版本不对

第一种方法:这时我们只需要右键点击项目,这时会出现如图所示:

eclipse The import junit cannot be resolved

点击Build Path,再点击configure Bulid path,点击Classpath,再点击Add library 

eclipse The import junit cannot be resolved

 这时会出现如图所示界面,点击Junit,选择next

eclipse The import junit cannot be resolved

最后选择Junit4,Finish,  Appay就好了

eclipse The import junit cannot be resolved

 第二种方法:当第一种方法失效时,这个时候可能是JRE的版本不对

方法二与方法一前几个步骤相同,就是 librarys 不一样,点击Edit

eclipse The import junit cannot be resolved

这时 点击一个Java se1.7  然后 点击Finish    Apply就可以了

eclipse The import junit cannot be resolved