0

So it goes without saying that I'm pretty hopeless at writing these sort of scripts, but I'm at a complete loss at what I'm doing wrong. I'm trying to run my JUnit tests with this and while the tests compile and it sees the junit.jar file (which is in the same folder as the junit tests). It keeps saying that it "Could not find class [TestClass]" though. Could someone maybe point me in the right direction?

> set path=C:\Program Files\Java\jdk1.8.0_60\bin
> javac -cp "junit-4.12.jar" *.java 
> java -cp "junit-4.12.jar" org.junit.runner.JUnitCore Testclass
> pause
  • Very simple: the classpath that you give to your JUnit RUN is **incomplete**. It is missing that path that contains your compiled test class! – GhostCat Oct 07 '16 at 18:43
  • Ok thanks! Could you explain how I can add the classpath in? Apologies if that's too much to ask, but I'm really just learning as I go here. – Chandler Manns Oct 07 '16 at 18:48
  • Just read the question I "duplicated" to. Thats the whole point - you find your answers there! – GhostCat Oct 07 '16 at 19:07
  • Ok so I read it over and figured that what I was doing wrong was that I was not having the classpath as a path to the top of the package hierarchy, so I redid my code by moving back in the directory and changing the third line of the script to be like so: > java -cp "package/junit-4.12.jar" org.junit.runner.JUnitCore package.Testclass. However I'm getting the same problem as before. – Chandler Manns Oct 07 '16 at 19:33

0 Answers0