I know this is very common problem and i already did search but somehow it could not resolve my problem.
Here is the problem context:
Created a maven project(Using eclipse with maven quickstart and used Junit version 4.12) for my Junit test cases. Following is the structure-
And this is the content of Junit file-
package JunitRnD.JunitArtifact;
import static org.junit.Assert.*;
import java.util.Stack;
import org.junit.Test;
public class AppTest {
@Test
public void emptyTest() {
Stack<String> stack = new Stack<String>();
assertTrue(stack.isEmpty());
}
}
Project is located under this location:
/Users/_eclipseWork/JunitArtifact
And this is the content of the directory-
Junit test works from eclipse. But i want to run it from command line. So I used following command-
cd /Users/_eclipseWork/JunitArtifact
java -cp .:/Users/.m2/repository/junit/junit/4.12/junit-4.12.jar:/Users/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar org.junit.runner.JUnitCore JunitRnD/JunitArtifact/AppTest
I also used other variant per directory structure, but always received following error-
Caused by: java.lang.ClassNotFoundException: JunitRnD/JunitArtifact/AppTest
What am i missing here?
PS: Also tried with putting .java and .class extension.