Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

Jar NoClassDefFoundError with main class

 
 
andrew123
Guest
Posts: n/a
 
      06-08-2005
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

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      06-08-2005
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
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
 
Reply With Quote
 
 
 
Reply

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 greg.knaddison@gmail.com 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



Advertisments