i need help to install Junit in my computer, so I can create unit tests to run in JMeter.
The problem is that when I try to test if the JUnit installation is correct, it gives the following message:
“Error: Could not find or load main class org.junit.runner.JUnitCore”
Here are the configurations of the variables:
Environment variables
JAVA_HOME = C:\Program Files\Java\jdk1.7.0_03
JUNIT_HOME = C:\junit
in Path = %JAVA_HOME%\bin;%JUNIT_HOME%\junit-4.10.jar
Tests in cmd:
C:\Users\luis.ribeiro>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.7.0_03
C:\Users\luis.ribeiro>echo %JUNIT_HOME%
C:\junit
C:\Users\luis.ribeiro>java -version
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b05)
Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)
C:\Users\luis.ribeiro>java org.junit.runner.JUnitCore org.junit.tests.AllTests
Error: Could not find or load main class org.junit.runner.JUnitCore
Could someone help me with this problem please.
I will be very thank full,
With the best regards,
Luis
You need to add junit to the CLASSPATH, not the PATH.
Example from the FAQ: