ant - Cannot find package org.junit when compiling java file in command prompt -


whenever run java file in command prompt, keep getting errors saying:

error: package org.junit not exist import static org.junit.assert.*; 

this gives errors on symbols "@test".

here's java file code:

package org.example.antbook.junit;  //import required junit4 classes: import static org.junit.assert.*; import org.junit.test;  public class simpletest {     @test         public void testsomething()      {         asserttrue("multiplication???", 4 == (2 * 2));     } } 

i believe importing junit-4.10.jar have imported, may missing something. there solution this?

you need put "junit.jar" on classpath when compile , when run class.

please refer manual entries java , javac commands, , page on setting classpath.

if building command line using ant, need make sure "build.xml" sets compilation classpath correctly.


you need add import statements import junit 4 annotations use. need address "package org.junit not exist" issue first.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -