我曾尝试,并试图再次建立一个Ant构建在这里我的项目概要:
NoClassDefFoundError的与外部JAR文件的Windows命令行运行Java时
这是构建文件我试图运行:
<project> <target name="clean"> <delete dir="build" /> </target> <path id="jarpath"> <fileset dir="C:\JAR"> <include name="**" /> </fileset> </path> <target name="compile"> <mkdir dir="build/classes" /> <javac srcdir="." destdir="build/classes" includeantruntime="false"> <classpath id="jarpath" /> <classpath> <pathelement path="jarpath" /> </classpath> </javac> </target> <target name="jar"> <mkdir dir="build/jar" /> <jar destfile="build/jar/TestCase1.jar" basedir="build/classes"> <manifest> <attribute name="Main-Class" value="NSSR.TestCase1" /> </manifest> </jar> <jar destfile="build/jar/UniversalVariables.jar" basedir="build/classes"> <manifest> <attribute name="Main-Class" value="NSSR.UniversalVariables" /> </manifest> </jar> </target> </project>
当我把“蚁编译”到Windows命令行中,它给了我一个错误的这个庞然大物:
Buildfile: C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Case s\src\build.xml compile: [javac] Compiling 4 source files to C:\Documents and Settings\jradcliffe\wor kspace\ITSM_Upgrade_Test_Cases\src\build\classes [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:3: package com.thoughtworks.selenium does not exist [javac] import com.thoughtworks.selenium.*; [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:4: package org.junit does not exist [javac] import org.junit.After; [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:5: package org.junit does not exist [javac] import org.junit.Before; [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:6: package org.junit does not exist [javac] import org.junit.Test; [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:10: cannot find symbol [javac] symbol: class SeleneseTestCase [javac] public class TestCase1 extends SeleneseTestCase { [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:3: package com.thoughtworks.selenium does not exist [javac] import com.thoughtworks.selenium.*; [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:4: package org.junit does not exist [javac] import org.junit.After; [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:5: package org.junit does not exist [javac] import org.junit.Before; [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:6: package org.junit does not exist [javac] import org.junit.Test; [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:10: cannot find symbol [javac] symbol: class SeleneseTestCase [javac] public class TestCase1 extends SeleneseTestCase { [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:23: cannot find symbol [javac] symbol : class Before [javac] location: class NSSR.TestCase1 [javac] @Before [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:30: cannot find symbol [javac] symbol : class Test [javac] location: class NSSR.TestCase1 [javac] @Test [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:65: cannot find symbol [javac] symbol : class After [javac] location: class NSSR.TestCase1 [javac] @After [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:23: cannot find symbol [javac] symbol : class Before [javac] location: class TestCase1 [javac] @Before [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:30: cannot find symbol [javac] symbol : class Test [javac] location: class TestCase1 [javac] @Test [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:65: cannot find symbol [javac] symbol : class After [javac] location: class TestCase1 [javac] @After [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:25: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium = new DefaultSelenium("localhost", 4444, "*fire fox", [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:25: cannot find symbol [javac] symbol : class DefaultSelenium [javac] location: class NSSR.TestCase1 [javac] selenium = new DefaultSelenium("localhost", 4444, "*fire fox", [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:27: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.start(); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:32: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.open(UniversalVariables.loginPage); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:33: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.type("name=USERNAME", UniversalVariables.userna me); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:34: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.type("name=PASSWORD", UniversalVariables.passwo rd); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:35: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.click("link=Submit"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:36: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.waitForPageToLoad("60000"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:37: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.open("/itg/dashboard/app/portal/PageView.jsp?IS _WINDOID=N"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:38: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.click("link=Create"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:39: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.click("link=Request"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:40: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.waitForPageToLoad("30000"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:41: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.select("name=REQUEST_TYPE_CREATE", [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:43: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.click("css=span.secBtn > a"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:44: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.waitForPageToLoad("30000"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:55: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.type("id=REQ.DESCRIPTION", title); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:56: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.type("id=REQ.P.REQUESTORAC_TF", req); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:57: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.select("id=REQ.P.REQUESTOR_DEPT", dept); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:58: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.type("id=REQ.P.DETAIL_DESC", desc); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:59: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.type("REQ.P.REQ_COMPL_DATE", date); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:60: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.click("link=Submit"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:61: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.waitForPageToLoad("30000"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:62: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.refresh(); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\NSSR\TestCase1.java:67: cannot find symbol [javac] symbol : variable selenium [javac] location: class NSSR.TestCase1 [javac] selenium.stop(); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:25: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium = new DefaultSelenium("localhost", 4444, "*fire fox", [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:25: cannot find symbol [javac] symbol : class DefaultSelenium [javac] location: class TestCase1 [javac] selenium = new DefaultSelenium("localhost", 4444, "*fire fox", [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:27: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.start(); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:32: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.open(UniversalVariables.loginPage); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:33: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.type("name=USERNAME", UniversalVariables.userna me); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:34: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.type("name=PASSWORD", UniversalVariables.passwo rd); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:35: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.click("link=Submit"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:36: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.waitForPageToLoad("60000"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:37: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.open("/itg/dashboard/app/portal/PageView.jsp?IS _WINDOID=N"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:38: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.click("link=Create"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:39: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.click("link=Request"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:40: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.waitForPageToLoad("30000"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:41: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.select("name=REQUEST_TYPE_CREATE", [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:43: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.click("css=span.secBtn > a"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:44: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.waitForPageToLoad("30000"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:55: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.type("id=REQ.DESCRIPTION", title); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:56: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.type("id=REQ.P.REQUESTORAC_TF", req); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:57: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.select("id=REQ.P.REQUESTOR_DEPT", dept); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:58: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.type("id=REQ.P.DETAIL_DESC", desc); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:59: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.type("REQ.P.REQ_COMPL_DATE", date); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:60: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.click("link=Submit"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:61: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.waitForPageToLoad("30000"); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:62: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.refresh(); [javac] ^ [javac] C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cas es\src\TestCase1.java:67: cannot find symbol [javac] symbol : variable selenium [javac] location: class TestCase1 [javac] selenium.stop(); [javac] ^ [javac] 64 errors BUILD FAILED C:\Documents and Settings\jradcliffe\workspace\ITSM_Upgrade_Test_Cases\src\build .xml:15: Compile failed; see the compiler error output for details. Total time: 1 second
基本上说,它似乎并没有从我的jar文件,我想使因为我不引用它们在编译目标感承认什么。 问题是,我不知道引用它们(这是我的第一个构建文件除了我的Hello World)。
谢谢