f



java.lang.NoClassDefFoundError (AGAIN!)

Searching google, I know this question has been asked tens of thousands of times, and
after reading hundreds of answers I'm still perplexed.  After 2 weeks, I thrown in the
towel and implore you for some assistance.

I wrote a program using NetBeans 4.0.  Naturally, I can run the program within the IDE. I
can also run the class file with the vendor jar file from the command line just fine, but
when I try to run my program as a jar file, I'm running into problems.


(why am I getting this error?)

K:\FTPTest\FTP\dist>java classpath=.;k:\edtftpj.jar -jar FTP.jar
Exception in thread "main" java.lang.NoClassDefFoundError: classpath=/;k:\edtftp
j/jar


(So, I copy the jar file to my current directory)

K:\FTPTest\FTP\dist>copy k:\edtftpj.jar .
         1 file(s) copied.


(this error mystifies me)

K:\FTPTest\FTP\dist>java classpath=.;edtftpj.jar -jar FTP.jar
Exception in thread "main" java.lang.NoClassDefFoundError: classpath=/;edtftpj/j
ar


(but when I explicitly set the classpath, that error disappears)

K:\FTPTest\FTP\dist>set classpath=.;edtftpj.jar


(but now I'm faced with the infamous java.lang.NoClassDefFoundError

K:\FTPTest\FTP\dist>java -jar FTP.jar
Exception in thread "main" java.lang.NoClassDefFoundError: com/enterprisedt/net/
ftp/FTPMessageListener

What am I doing wrong?

0
bob6348 (5)
12/6/2004 12:35:44 PM
comp.lang.java.help 13339 articles. 0 followers. Post Follow

2 Replies
956 Views

Similar Articles

[PageSpeed] 52

"Bob" <Bob@nospam.net> wrote in message news:RmYsd.183$HH6.136@fe07.lga...
> Searching google, I know this question has been asked tens of thousands of 
> times, and
> after reading hundreds of answers I'm still perplexed.  After 2 weeks, I 
> thrown in the
> towel and implore you for some assistance.
>
> I wrote a program using NetBeans 4.0.  Naturally, I can run the program 
> within the IDE. I
> can also run the class file with the vendor jar file from the command line 
> just fine, but
> when I try to run my program as a jar file, I'm running into problems.
>
>
> (why am I getting this error?)
>
> K:\FTPTest\FTP\dist>java classpath=.;k:\edtftpj.jar -jar FTP.jar
> Exception in thread "main" java.lang.NoClassDefFoundError: 
> classpath=/;k:\edtftp
> j/jar
>
Should be java -classpath=.... (Note the minus)

[...]
> (but when I explicitly set the classpath, that error disappears)
>
> K:\FTPTest\FTP\dist>set classpath=.;edtftpj.jar
>
Predictably.

> (but now I'm faced with the infamous java.lang.NoClassDefFoundError
>
> K:\FTPTest\FTP\dist>java -jar FTP.jar
> Exception in thread "main" java.lang.NoClassDefFoundError: 
> com/enterprisedt/net/
> ftp/FTPMessageListener
>
> What am I doing wrong?
>
Where is the com.enterprisedt.net.ftp.FTPMessageListener class? 


0
zzanNOtozz (927)
12/6/2004 12:44:15 PM
Ryan Stewart wrote:
> "Bob" <Bob@nospam.net> wrote in message news:RmYsd.183$HH6.136@fe07.lga...
>> Searching google, I know this question has been asked tens of thousands of times, and
>>  after reading hundreds of answers I'm still perplexed.  After 2 weeks, I thrown in
>> the towel and implore you for some assistance.
>> 
>> I wrote a program using NetBeans 4.0.  Naturally, I can run the program within the
>> IDE. I can also run the class file with the vendor jar file from the command line 
>> just fine, but when I try to run my program as a jar file, I'm running into problems.
>> 
>> 
>> 
>> (why am I getting this error?)
>> 
>> K:\FTPTest\FTP\dist>java classpath=.;k:\edtftpj.jar -jar FTP.jar Exception in thread
>> "main" java.lang.NoClassDefFoundError: classpath=/;k:\edtftp j/jar
>> 
> Should be java -classpath=.... (Note the minus)

OMG! Just how dumb can I be?  I hope my new monitor will help me see better 8-)

> 
> [...]
>> (but when I explicitly set the classpath, that error disappears)
>> 
>> K:\FTPTest\FTP\dist>set classpath=.;edtftpj.jar
>> 
> Predictably.

Hanging my head in shame.

> 
>> (but now I'm faced with the infamous java.lang.NoClassDefFoundError
>> 
>> K:\FTPTest\FTP\dist>java -jar FTP.jar Exception in thread "main"
>> java.lang.NoClassDefFoundError: com/enterprisedt/net/ ftp/FTPMessageListener
>> 
>> What am I doing wrong?
>> 
> Where is the com.enterprisedt.net.ftp.FTPMessageListener class?
> 

com.enterprisedt.net.ftp.FTPMessageListener is in edtftpj.jar

I read somewhere that I need to put the classpath to a jar file (edtftpj.jar in this case) 
into the manifest file for my jar file but it's not clear to me how to accomplish this.

Is it possible to incorporate other jar files into my jar file so that when I distribute
my jar file, I know for certain that everything has been included?

> 
0
bob6348 (5)
12/10/2004 10:40:16 PM
Reply: