Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Jeff Higgins Newsgroups: comp.lang.java.programmer Subject: Re: can't find in classpath, but only when running from the jar file Date: Mon, 15 Oct 2012 11:31:22 -0400 Organization: A noiseless patient Spider Lines: 45 Message-ID: References: <4a7b7c26-806b-4a3d-8fed-f56e35ba8d76@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 15 Oct 2012 15:25:06 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="6a6a291fa7e9c0bd872c1a9cbe2b371d"; logging-data="6634"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/dRMYoaonR5qIGJ3O2lJuKr2VL1B1DD+g=" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20120925 Icedove/3.0.11 In-Reply-To: Cancel-Lock: sha1:wQLAuXUv37Iq/08kWIohrgBIBk4= Xref: csiph.com comp.lang.java.programmer:19357 On 10/15/2012 11:22 AM, Jeff Higgins wrote: > On 10/15/2012 10:56 AM, Stryder wrote: >> I'm trying to run a Java class in a jar file. The jar file contains >> this class: >> >> com/exacttarget/wsdl/partnerapi/PartnerAPIStub.class >> >> The manifest looks like this (not indented). >> >> Manifest-Version: 1.0 >> Ant-Version: Apache Ant 1.8.4 >> Created-By: 1.7.0_03-b04 (Oracle Corporation) >> Main-Class: com.exacttarget.wsdl.partnerapi.PartnerAPIStub >> >> All the main class does is print "hello world". It works (prints >> "Hello World") if I do this in the classes directory... >> >> java com.exacttarget.wsdl.partnerapi.PartnerAPIStub >> >> This same class is definitely in the jar file as demonstrated by this >> command... >> >> bash-4.1$ jar tf PartnerAPI-test-client.jar |grep Stub.class >> com/exacttarget/wsdl/partnerapi/PartnerAPIStub.class >> bash-4.1$ >> >> but when I try to run the jar, with the environment exactly as it was >> when I ran the class separately, using this command... >> >> java -jar PartnerAPI-test-client.jar >> >> I get this error output... >> >> Exception in thread "main" java.lang.NoClassDefFoundError: >> org/apache/axis2/client/Stub >> >> Obviously I'm missing something. Any help would very much be appreciated. >> > I think you're missing a Class-Path attribute. > Class-Path: The value of this attribute specifies the relative URLs of > the extensions or libraries that this application or extension needs. > URLs are separated by one or more spaces. The application or extension > class loader uses the value of this attribute to construct its internal > search path.