NoClassDefFoundError

View: New views
7 Messages — Rating Filter:   Alert me  

NoClassDefFoundError

by John-187 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Using Windows XP SP2, netbeans 5.0 update 6

Please bare with me while I ask a couple dumb questions. The first has
to do with release .jars vs ide debug runs. Why does my application run
when I press F5, but if I compile it with F11 and run it from the
command line I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/batik/tran
scoder/image/PNGTranscoder

Thanks

Re: NoClassDefFoundError

by Michel Graciano :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How are you ruuning you program in command line? The problem is that you have some jar that need to be added to your classpath. When you run inside IDE, the IDE do that for you.

On 4/29/06, John <johnbell@...> wrote:
Hi,

Using Windows XP SP2, netbeans 5.0 update 6

Please bare with me while I ask a couple dumb questions. The first has
to do with release .jars vs ide debug runs. Why does my application run
when I press F5, but if I compile it with F11 and run it from the
command line I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/batik/tran
scoder/image/PNGTranscoder

Thanks



--
Atenciosamente,

Michel Graciano
KSI Soluções em Informática Ltda.
http://www.jroller.com/page/hmichel
http://translatedfiles.netbeans.org/index_pt_BR.html
https://copypastehistory.dev.java.net/
https://jae.dev.java.net/

Re: NoClassDefFoundError

by John-187 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Michel Graciano wrote:
How are you ruuning you program in command line? The problem is that you have some jar that need to be added to your classpath. When you run inside IDE, the IDE do that for you.


Thanks very much, even if I to add the classpath to my PATH environment variable, what I would like is a standalone program, how do I compile that in NetBeans?


Re: NoClassDefFoundError

by Michel Graciano :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
The path environment variable don't work for this. you need pass the jar files for your program when executing in command line, with -cp option for java command (I presume that you are trying run the program with java -jar <jarfile>.jar).

On 4/30/06, John <johnbell@...> wrote:


Michel Graciano wrote:
How are you ruuning you program in command line? The problem is that you have some jar that need to be added to your classpath. When you run inside IDE, the IDE do that for you.


Thanks very much, even if I to add the classpath to my PATH environment variable, what I would like is a standalone program, how do I compile that in NetBeans?




--
Atenciosamente,

Michel Graciano
KSI Soluções em Informática Ltda.
http://www.jroller.com/page/hmichel
http://translatedfiles.netbeans.org/index_pt_BR.html
https://copypastehistory.dev.java.net/
https://jae.dev.java.net/

Re: NoClassDefFoundError

by Philip Warne :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well not wanting to "expose" too much but could it be that you didn't select a main and as consequence your manifest file is left "bare" of the project main class?

John <johnbell@...> wrote:
Hi,

Using Windows XP SP2, netbeans 5.0 update 6

Please bare with me while I ask a couple dumb questions. The first has
to do with release .jars vs ide debug runs. Why does my application run
when I press F5, but if I compile it with F11 and run it from the
command line I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/batik/tran
scoder/image/PNGTranscoder

Thanks


Get amazing travel prices for air and hotel in one click on Yahoo! FareChase

Re: NoClassDefFoundError

by Philip Warne :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Also make sure you see all the jars that your application uses in the lib directory under the dist folder.
 
cd /yourapp/dist
 
java -jar yourapp.jar
 
should do the trick.

John <johnbell@...> wrote:
Hi,

Using Windows XP SP2, netbeans 5.0 update 6

Please bare with me while I ask a couple dumb questions. The first has
to do with release .jars vs ide debug runs. Why does my application run
when I press F5, but if I compile it with F11 and run it from the
command line I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/batik/tran
scoder/image/PNGTranscoder

Thanks


Yahoo! Mail goes everywhere you do. Get it on your phone.

Re: NoClassDefFoundError

by Michael Powe-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Apr 29, 2006 at 07:56:43PM -0700, John wrote:
> Hi,
>
> Using Windows XP SP2, netbeans 5.0 update 6
 
> Please bare with me while I ask a couple dumb questions. The first has
> to do with release .jars vs ide debug runs. Why does my application run
> when I press F5, but if I compile it with F11 and run it from the
> command line I get the following error:
 
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/batik/tran
> scoder/image/PNGTranscoder

When you specify an external library in the configuration of a
project, NB should copy that library into dist/lib when you build the
application.  It should then add a classpath entry to the manifest so
that your application knows to look in lib.  It looks like that has
not happened.

Look in the dist directory and verify that lib/batik-transcoder.jar is
there ((and any other necessary libraries).  then open up the jar file
in winzip or some similar tool and verify that the Manifest has a
classpath entry pointing to lib.

I have had some intermittent problems with NB not properly completing
the process I just described.  If you do these things manually,
however, the jar will execute as expected.

Thanks.

mp

--
Michael Powe michael@... Naugatuck CT USA
"I wrote what I did because as a woman, as a mother, I was oppressed
and brokenhearted with the sorrows and injustice I saw, because as a
Christian I felt the dishonor to Christianity, -- because as a lover
of my country, I trembled at the coming day of wrath." -- H.B. Stowe


attachment0 (196 bytes) Download Attachment