Jar NoClassDefFoundError with main class

A

andrew123

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
 
A

Andrew Thompson

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top