Jar NoClassDefFoundError with main class

Discussion in 'Java' started by andrew123, Jun 8, 2005.

  1. andrew123

    andrew123 Guest

    Hi,

    I am really suffering with trying to execute a class from within a jar
    file.
    What I've done:-
    I have created a jar called tester.jar, within this jar I have a
    directory structure of
    com.amm.mar.bo.gh at the bo level I have my main class that supposed to
    run called tester.class
    I have other class files that are referenced at the gh level.I also
    reference the external packages of log4j and jdom(seperate jars in same
    dir)

    When I try to run this jar I get a

    Exception in thread "main" java.lang.NoClassDefFoundError: tester/java

    I run it by doing the following commands:-

    java -cp ./:tester.jar:./log4j.jar:/jdom.jar -jar tester.jar
    com.amm.mar.bo.tester

    I've also tried variants of this by having differnt classpaths, but to
    no avail. I created a manifest file as well
    which reads as:-

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.6.2
    Created-By: 1.4.2_03-b02 (Sun Microsystems Inc.)
    Version: 1.0
    Main-Class: com.amm.mar.bo.tester
    Class-Path: jdom.jar:log4j-1.2.9.jar:jconn3.jar:tester.jar


    The strange thing is it all works in eclipse and was built using
    ant....

    I've tried bith winxp and solaris...

    Any ideas what I'm doign wrong ?

    Cheers
     
    andrew123, Jun 8, 2005
    #1
    1. Advertising

  2. Andrew Thompson, Jun 8, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Alan Farrell
    Replies:
    6
    Views:
    9,761
    Andrew Thompson
    Jan 9, 2004
  2. hiwa
    Replies:
    1
    Views:
    1,595
    James Alan Farrell
    Jan 13, 2004
  3. cyril
    Replies:
    2
    Views:
    3,953
    cyril
    Aug 25, 2004
  4. Arnold Peters
    Replies:
    0
    Views:
    643
    Arnold Peters
    Jan 5, 2005
  5. Replies:
    1
    Views:
    2,225
    Irmen de Jong
    Jun 22, 2004
Loading...

Share This Page