简体   繁体   中英

Eclipse not recognizing import/build classpath

So I have a package that uses some junit imports. These ones in particular.

import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;

Eclipse will only recognize these imports half the time. I'll run it a few times, then all of a sudden the imports aren't recognized. I close eclipse, open back up, and it works again for a few times.

I'm completely stumped as to what could possibly be the problem and obviously the solution.

If your project is in Maven , then first you can click in Maven and do Maven Project.or using mvn clean install through cmd.If it is not a maven project, then in Eclipse Click on Project and select Clean, and check in Build Path junit.jar is there . i prefer to have lastest junit.jar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM