Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #19358

Re: can't find in classpath, but only when running from the jar file

Path csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From Jeff Higgins <jeff@invalid.invalid>
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:51:22 -0400
Organization A noiseless patient Spider
Lines 49
Message-ID <k5hb21$ee6$1@dont-email.me> (permalink)
References <4a7b7c26-806b-4a3d-8fed-f56e35ba8d76@googlegroups.com> <k5h9b5$2sa$1@dont-email.me>
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:45:06 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="6a6a291fa7e9c0bd872c1a9cbe2b371d"; logging-data="14790"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/6d5T1V69zFmtR3pU8Jc3gev1cm1IBlHs="
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 <k5h9b5$2sa$1@dont-email.me>
Cancel-Lock sha1:el/pgAwkCFO+sh7TOU2La5cLauc=
Xref csiph.com comp.lang.java.programmer:19358

Show key headers only | View raw


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

or a classpath option
java -jar -cp pathtomyaxis2clientjar 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.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

can't find in classpath, but only when running from the jar file Stryder <stryder100@gmail.com> - 2012-10-15 07:56 -0700
  Re: can't find in classpath, but only when running from the jar file Jeff Higgins <jeff@invalid.invalid> - 2012-10-15 11:22 -0400
    Re: can't find in classpath, but only when running from the jar file Jeff Higgins <jeff@invalid.invalid> - 2012-10-15 11:31 -0400
    Re: can't find in classpath, but only when running from the jar file Jeff Higgins <jeff@invalid.invalid> - 2012-10-15 11:51 -0400
      Re: can't find in classpath, but only when running from the jar file Nigel Wade <nmw@ion.le.ac.uk> - 2012-10-15 17:04 +0100
      Re: can't find in classpath, but only when running from the jar file Lew <lewbloch@gmail.com> - 2012-10-15 09:16 -0700
      Re: can't find in classpath, but only when running from the jar file Jeff Higgins <jeff@invalid.invalid> - 2012-10-15 13:00 -0400
  Re: can't find in classpath, but only when running from the jar file Roedy Green <see_website@mindprod.com.invalid> - 2012-10-15 19:43 -0700
  Re: can't find in classpath, but only when running from the jar file Arne Vajhoej <arne@vajhoej.dk> - 2012-10-17 11:52 -0400

csiph-web