在类路径中找不到类:

时间:2018-05-03 00:22:51

标签: java testng

我收到错误在类路径中找不到类:在Windows命令提示符下运行时。我知道之前已经问过同样的问题,我已经尝试过一切,但是没有用。请指教。感谢

enter image description here这是我正在使用的命令

Java -cp C:\Users\Admin\Downloads\
daily-installer-automation-master\
daily-installer-automation-master-e26d3512b5f2770b8388270ffcc3078e32571d9a\
src\test\resources;
C:\Users\Admin\Downloads\daily-installer-automation-master\
daily-installer-automation-master-e26d3512b5f2770b8388270ffcc3078e32571d9a\lib/*
org.testng.TestNG CreateUsers.xml

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Regression - Report Formatting" verbose="1" configfailurepolicy="continue">


<listeners>
<listener class-name="yellowfin.bi.extentReportListener.ExtentReportListener"/>
</listeners>


	
	<parameter name="axisA" value="1" />
	<parameter name="axisB" value="2" />
	<parameter name="viewName" value="Ski Team"></parameter>

	<!-- REPORT FIELDS -->
	<!-- this is your report data set -->

	
	<!-- yellowfin login credentials -->
	<parameter name="yellowfinURL" value="http://10.10.5.77:8082/" />
	<parameter name="userName" value="admin" />
	<parameter name="passsword" value="test" />
	<parameter name="uName" value="test@yellowfin2.com.au" />
	<parameter name="pass" value="test" />
	<parameter name="port" value="8082"/>
	<parameter name="address" value="10.10.5.77"/>
	
	<test name="CreateUsers">
		<classes>
			<class name="yellow.bi.test.CreateUsers">
				<methods>

					<include name="ImportUsers"></include>
					
					<!-- <include name=""></include> -->

				</methods>
			</class>
		</classes>
	</test>
</suite>
我已将命令更新为以下

  set projectLocation=C:\Users\Admin\Downloads\daily-installer-automation-master\daily-installer-automation-master-e26d3512b5f2770b8388270ffcc3078e32571d9a\
cd %projectLocation%
set classpath=%projectLocation%\bin;%projectLocation%lib\*
java org.testng.TestNG %projectLocation%CreateUsers.xml
pause

C:\Users\Admin\Downloads\daily-installer-automation-master\daily-installer-automation-master-e26d3512b5f2770b8388270ffcc3078e32571d9a>java org.testng.TestNG C:\Users\Admin\Downloads\daily-installer-automation-master\daily-installer-automation-master-e26d3512b5f2770b8388270ffcc3078e32571d9a\\CreateUsers.xml
java.io.FileNotFoundException: C:\Users\Admin\Downloads\daily-installer-automation-master\daily-installer-automation-master-e26d3512b5f2770b8388270ffcc3078e32571d9a\CreateUsers.xml (The system cannot find the file specified)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at org.testng.xml.Parser.parse(Parser.java:165)
        at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:305)
        at org.testng.TestNG.run(TestNG.java:1088)
        at org.testng.TestNG.privateMain(TestNG.java:1434)
        at org.testng.TestNG.main(TestNG.java:1403)
[TestNG] [ERROR] No test suite found. Nothing to run
Usage: <main class> [options] The XML suite files to run
  Options:
    -configfailurepolicy
       Configuration failure policy (skip or continue)
    -d
       Output directory
    -dataproviderthreadcount
       Number of threads to use when running data providers
    -excludegroups
       Comma-separated list of group names to  exclude
    -groups
       Comma-separated list of group names to be run
    -junit
       JUnit mode
       Default: false
    -listener
       List of .class files or list of class names implementing ITestListener or
       ISuiteListener

这是我现在使用的命令

java -cp C:\Users\Admin\Downloads\daily-installer-automation-master\daily-installer-automation-master-e26d3512b5f2770b8388270ffcc3078e32571d9a\lib*;C:\Users\Admin\Downloads\daily-installer-automation-master\daily-installer-automation-master-e26d3512b5f2770b8388270ffcc3078e32571d9a\src\test\resources
org.testng.TestNG testng.xml

pause

现在我收到以下消息

C:\Users\Admin\Desktop>java -cp C:\Users\Admin\Downloads\daily-installer-automation-master\daily-installer-automation-master-e26d3512b5f2770b8388270ffcc3078e32571d9a\lib*;C:\Users\Admin\Downloads\daily-installer-automation-master\daily-installer-automation-master-e26d3512b5f2770b8388270ffcc3078e32571d9a\src\test\resources
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32          use a 32-bit data model if available
    -d64          use a 64-bit data model if available
    -server       to select the "server" VM
                  The default VM is server.

    -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
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.

C:\Users\Admin\Desktop>org.testng.TestNG testng.xml
'org.testng.TestNG' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Admin\Desktop>pause
Press any key to continue . . .

0 个答案:

没有答案