Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Jar NoClassDefFoundError with main class

Thread Tools

Jar NoClassDefFoundError with main class

Posts: n/a

I am really suffering with trying to execute a class from within a jar
What I've done:-
I have created a jar called tester.jar, within this jar I have a
directory structure of 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

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

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
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

I've tried bith winxp and solaris...

Any ideas what I'm doign wrong ?


Reply With Quote
Andrew Thompson
Posts: n/a
On 8 Jun 2005 11:00:57 -0700, andrew123 wrote:

> I am really suffering with trying to execute a class from within a jar
> file.

See my other post, and please refrain form making posts
so soon after one another.

Andrew Thompson Web & IT Help Open-source software suite Science & Technology Images that escape the mundane
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
instanciate a class in a jar file with class.forname, while my main class is in another jar cyril Java 2 08-25-2004 06:55 AM
java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory Python 1 06-22-2004 10:58 PM
Jar file cannot find main class - gfSetup.jar (0/1) hiwa Java 1 01-13-2004 01:41 AM
Jar file cannot find main class - gfSetup.jar (0/1) James Alan Farrell Java 6 01-09-2004 12:40 PM