如何在mac os命令终端

时间:2018-03-07 15:03:40

标签: java testng

当我尝试从windows机器执行我的testng时,我能够毫无问题地执行mky测试。

我正在使用命令:java -cp bin;jarslib/* org.testng.TestNG testng.xml 我在项目文件夹中的jarslib文件夹中放了所有的罐子。

但是当我从MAC OS执行时,我遇到了以下错误:

Usage: java [-options] class [args...]
       (to execute a class)

或java [-options] -jar jarfile [args ...]            (执行jar文件) 选项包括:     -d32使用32位数据模型(如果可用)     -d64使用64位数据模型(如果可用)     -server选择“服务器”VM                   默认VM是服务器,                   因为你在服务器级机器上运行。

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
              A : separated list of directories, JAR archives,
              and ZIP archives to search for class files.
-D<name>=<value>
              set a system property
-verbose:[class|gc|jni]
              enable verbose output
-version      print product version and exit
-version:<value>
              Warning: this feature is deprecated and will be removed
              in a future release.
              require the specified version to run
-showversion  print product version and continue
-jre-restrict-search | -no-jre-restrict-search
              Warning: this feature is deprecated and will be removed
              in a future release.
              include/exclude user private JREs in the version search
-? -help      print this help message
-X            print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
              enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
              disable assertions with specified granularity
-esa | -enablesystemassertions
              enable system assertions
-dsa | -disablesystemassertions
              disable system assertions
-agentlib:<libname>[=<options>]
              load native agent library <libname>, e.g. -agentlib:hprof
              see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
              load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
              load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
              show splash screen with specified image

有关详细信息,请参阅http://www.oracle.com/technetwork/java/javase/documentation/index.html。 jarslib / bsh-2.0b6.jar:第1行:PK:未找到命令 jarslib / bsh-2.0b6.jar:第2行:                               ?EH:命令未找到 jarslib / bsh-2.0b6.jar:第3行:找不到命令 jarslib / bsh-2.0b6.jar:第4行:意外标记)' jarslib/bsh-2.0b6.jar: line 4:附近的语法错误?EH?Je?^ META-INF / MANIFEST.MFm ?? N1                                                                  ??海兰?eH.9t?d {C 1-4。)M ??ҩoO'

1 个答案:

答案 0 :(得分:2)

由于类路径中的分号,shell将您的命令解释为2个命令。请使用冒号(:)作为分隔符:

java -cp bin:jarslib/* org.testng.TestNG testng.xml