tags:

views:

193

answers:

2

Hello, I would like to compile JUnit from windows command line.

I have a project that contains many different packages. I can compile and run this project from the command line. However, I have difficulties to compile JUnit class that I have created.

My JUnit class imports only my model and uses the methods to ensure that my model is correct. Therefore, there is a dependency. My question is that how can I compile and run my JUnit class without using ant?

Thanks in advance

+3  A: 

You should be able to include the JUnit jar in your class path.

java -cp junit-4.8.1.jar;yourfiles.jar com.your.class
Allain Lalonde
+5  A: 

If you already manage to compile the rest of your project, then adding JUnit to javac's command line should allow you to compile JUnit-dependent code.

Try adding -cp /full/path/to/your/junit.jar to the command line.

Eli Acherkan