Command line 如何让JUnit4.10在Windows上从命令行运行而不键入每个文件的路径?

Command line 如何让JUnit4.10在Windows上从命令行运行而不键入每个文件的路径?,command-line,junit,installation,classpath,Command Line,Junit,Installation,Classpath,我想这对其他人来说很容易,但我无法从命令行让junit工作。我在安装java运行时环境时没有遇到任何问题,但是这个junit安装有很多我没有看到的地方 我的类路径是: .;C:\Program Files\Java\jre6\lib\ext\QTJava.zip.;set classpath=%classpath%;C:Program Files\JUnit\junit-4.6.jar;C:\Program Files\JUnit\ %SystemRoot%\system32;%SystemR

我想这对其他人来说很容易,但我无法从命令行让junit工作。我在安装java运行时环境时没有遇到任何问题,但是这个junit安装有很多我没有看到的地方

我的类路径是:

.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip.;set classpath=%classpath%;C:Program Files\JUnit\junit-4.6.jar;C:\Program Files\JUnit\
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\wbem;C:\Program Files\Common Files\Teleca Shared;C:\Program Files\Java\jdk1.6.0_30\bin;C:\Program Files\JUnit\junit-4.10.jar;C:\Program Files\QuickTime\QTSystem\
我的windows路径是:

.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip.;set classpath=%classpath%;C:Program Files\JUnit\junit-4.6.jar;C:\Program Files\JUnit\
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\wbem;C:\Program Files\Common Files\Teleca Shared;C:\Program Files\Java\jdk1.6.0_30\bin;C:\Program Files\JUnit\junit-4.10.jar;C:\Program Files\QuickTime\QTSystem\

有人请告诉我我做错了什么。我无法让junit运行其测试文件或我编写的任何文件。

您不应该将内容放在JRE lib/ext目录中。学习如何正确使用类路径

如果类路径是一个环境变量,那么您正在学习一些重要的东西:您不需要它。JVM、IDE和应用服务器都会忽略它

正确的方法是在编译和运行时在javac.exe和java.exe上使用-classpath选项

您也不应该改变每个Java项目的路径。将它指向JDK/bin,这样您就可以访问所需的工具,但这就是您应该做的全部