Could not find class in JUnit 4.11

Viewed 3134

First of all, I've looked at all of the similar questions on stack overflow and nothing has worked for me yet. Just trying to get JUnit to work with a simple example from the book JUnit in Action 2nd Edition by Peter Tahchiev.

Calculator.java

public class Calculator {
    public double add(double number1, double number2) {
        return number1 + number2;
    }
}

CalculatorTest.java

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

public class CalculatorTest {

    @Test
    public void testAdd() {
        Calculator calc = new Calculator();
        double result = calc.add(1,1);
        assertEquals(2, result,0);
    }
}

My folder: Current Folder

I compile with:

javac -cp junit-4.11.jar *.java

My folder after compiling: Current Folder after compiling

I Try to Run Test with:

java -cp junit-4.11.jar;hamcrest-core-1.3.jar;. org.junit.runner.JUnitCore CalculatorTest

This is my output:

Output

When I try to run the individual classes the jre finds them but throws a no main method error which is expected:

java Calculator
java CalculatorTest

Outputs(which were expected, but it found the classes): Error 1 Error 2

Any ideas how I can get JUnit/whatever it is to behave?

[EDIT]
I run all commands in C:\Users\Zach\Documents\docs\Code\JUnit
The screenshots above are of the same folder.
I'm using jdk1.7.0_45 and jre7
I'm using Windows 7 Professional N 64 - bit

I ran the java command using -verbose:class and there were no errors except the one on line 426 which is seen below: verbose error

1 Answers
Related