Search code examples
javajunit

Why can't java find the JUnit framework?


I am trying to get a test class compiling with JUnit, and I can't figure out why it will not compile.

I have the following lines at the top of my class:

import java.util.*;
import org.junit.*;

And the error I am getting is

package org.junit does not exist

JUnit.jar is currently located in Program Files\JUnit\junit.jar, which currently also resides in my class path. I am working on Windows Vista if that helps.

Any ideas on how I can compile this test class with JUnit?


Solution

  • What version of JUnit are you using?

    I think that until JUnit 3, the package was different:

     import junit.framework.*;
    

    Also, if you are using Eclipse, you can pick the JUnit framework to use.