Vojta Matras
Vojta Matras

Reputation: 71

Cannot resolve package org.junit in my test class

I have this problem in my java IDE:

After adding the library to the Test Libraries, package org.junit is still missing.

screenshot showing added library

Upvotes: 0

Views: 576

Answers (3)

Jan
Jan

Reputation: 13858

By adding your JUnit Library to your Test Libraries, the org.junit package is available for the sources in your Test Packages

Either move your Test MatrixTest into your Test Packages (preferred) or add JUnit to your Libraries

The idea of putting tests into Test packages is to not deliver them in the final product while still have them in the project. Your final product will not need JUnit to run - only your tests do.

Upvotes: 1

Jiri Tousek
Jiri Tousek

Reputation: 12440

Your MatrixTest should be in the "Test Packages", not "Source Packages". I think the JUnit library defined as it is is only used for the test package.

Upvotes: 0

v.ladynev
v.ladynev

Reputation: 19956

You need to add this library to the classpath too.

Upvotes: 0

Related Questions