Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why do I get NoClassDefFoundError????

 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to run an java application but facing one major stubling block it does not want to run.
C:\java-coding\ftpbean-my2>java FtpExample
Exception in thread "main" java.lang.NoClassDefFoundError: FtpExample
Why???
Here is all the classes in the directory:
C:\java-coding\ftpbean-my2>dir *.class
Volume in drive C has no label
Volume Serial Number is 1631-1CEC
Directory of C:\java-coding\ftpbean-my2
FTPBEA~1 CLA 17,208 09-18-02 11:40p FtpBean.class
FTPREP~1 CLA 1,355 09-18-02 11:40p FtpReplyResourceBundle.class
FTPEXC~1 CLA 224 09-18-02 11:40p FtpException.class
FTPOBS~1 CLA 149 09-18-02 11:40p FtpObserver.class
FTPLIS~1 CLA 5,644 09-18-02 11:40p FtpListResult.class
SOCKET~1 CLA 275 09-18-02 11:40p SocketOpener$SocketFactory.class
SOCKET~2 CLA 724 09-18-02 11:40p SocketOpener$1.class
SOCKET~3 CLA 739 09-18-02 11:40p SocketOpener$2.class
SOCKET~4 CLA 895 09-18-02 11:40p SocketOpener$3.class
SOCKET~5 CLA 885 09-18-02 11:40p SocketOpener$4.class
SOCKET~6 CLA 701 09-18-02 11:40p SocketOpener$5.class
SOCKET~7 CLA 1,792 09-18-02 11:40p SocketOpener.class
FTPBEA~2 CLA 9,778 09-18-02 11:40p FtpBeanBeanInfo.class
FTPLIS~2 CLA 4,691 09-18-02 11:40p FtpListResultBeanInfo.class
FTPEXA~1 CLA 2,104 09-18-02 11:40p FtpExample.class
15 file(s) 47,164 bytes
0 dir(s) 4,370.62 MB free
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This definitely looks like a CLASSPATH problem. Make sure that your class directory is in your CLASSPATH env variable
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>Blake Minghelli
Yes it seems to be classpath problem
but I am not sure why?
I tried the program at another computer and the program worked there without changing a single line of code.
My autoexac.bat file is where I declare the classpath but it seems to be prettty much identical as the other PC apart from small differences like path.
Here is the path and classpath setting, can anyone spot anything I have missed?

PATH C:\WINDOWS;C:\WINDOWS\COMMAND;C:\j2sdk1.4.0_01\BIN;C:\WINDOWS\jwsdp-1_0_01\bin;
SET CLASSPATH=.;
SET CLASSPATH=C:\WINDOWS;C:\WINDOWS\COMMAND;
SET CLASSPATH=C:\j2sdk1.4.0_01\BIN;C:\My_DL_Dap\java-ftp-dl\build; C:\My_DL_Dap\java-ftp-dl\build\ftp.jar;$CLASSPATH
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every time you do a SET CLASSPATH=BLAHBLAH
you are replacing the previous BLAHBLAH with the
new BLAHBLAH.
So to fix it put ;%CLASSPATH% at the end of each
line:
SET CLASSPATH=.;%CLASSPATH%
SET CLASSPATH=BLAHBLAH;%CLASSPATH%
and so on.
In that way you will accumulate all the classpath elements into one gigantic enormous CLASSPATH.
-Barry
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I put comments in the autoexec.bat file?
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A bit of a side track, but it's
REM And now for something completely BASIC
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Barry
Why do you keep quoting from Sun?
I am stymied.
My development of software is never for malicious concern.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I just got some work for a nuclear power station, they wanna program for pulling rods in and out and stuff like that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic