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


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

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

Newsgroups comp.lang.java.programmer
Date 2012-10-15 07:56 -0700
Message-ID <4a7b7c26-806b-4a3d-8fed-f56e35ba8d76@googlegroups.com> (permalink)
Subject can't find in classpath, but only when running from the jar file
From Stryder <stryder100@gmail.com>

Show all headers | View raw


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.

Back to comp.lang.java.programmer | Previous | NextNext 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