0

Basically, I created a build.xml for Apache Ant. I use all the .jar files such as easymock.jar, junit.jar, which I downloaded straight from the their websites for my library (set in build.xml).

When I created a new unit test file using those two above .jar files by:

import static org.easymock.EasyMock.expect;
import static org.junit.Assert.*;

Eclipse generated bunch of errors. However, when I ran build.xml as Ant, this didn't seem to be a problem (no compile errors). I guess Eclipse doesn't recognize the external libraries until it actually compiles. How do I ignore these errors for certain unit test files? Or more generally, make Eclipse recognize external libraries?

knd
  • 1,662
  • 2
  • 15
  • 27

2 Answers2

0

Look in Project properties->Java Build Path. This has options to add jars to your project.

Matthew Farwell
  • 60,889
  • 18
  • 128
  • 171
0

Simply putting the jar files in the project does not guarantee that it is included in the Project Class path. You need to set it manually.

In Properties-->Java Build Path, add a User Library (for example) and include your jar files there.

Mawia
  • 4,220
  • 13
  • 40
  • 55