之所以出现此错误,是因为您尝试导入软件包而没有告知系统软件包的位置。以下是有关告诉系统软件包位置的说明:
您的javac目标没有指定源目录和目标目录之外的任何内容-它不添加任何类路径条目;您需要为相应的JUnit
jar文件添加一个条目。有关更多详细信息,请参见javac任务文档。您可能希望将JUnit的路径指定为classpath属性,嵌套元素或对在其他地方声明的路径的引用。
- javac任务文档
prompt> javac -classpath .;$JUNIT_HOMEjunit4.x.x.jar test.java
编辑:JUNIT安装(从 这里):
视窗
要在Windows上安装JUnit,请执行以下步骤:
1. Unzip the junit.zip distribution file to a directory referred to as%JUNIT_HOME%.
2. Add JUnit to the classpath (type the following into a command lineshell):
set CLASSPATH=%CLASSPATH%;%JUNIT_HOME%junit.jarUnix(bash)
要在Unix上安装JUnit,请按照以下步骤操作:
1. Unzip the junit.zip distribution file to a directory referred to as$JUNIT_HOME.
2. Add JUnit to the classpath (type the following into terminal):`export CLASSPATH=$CLASSPATH:$JUNIT_HOME/junit.jar`



