newbie with compiling  
Author Message
Libin Xie





PostPosted: 2003-10-24 20:38:00 Top

java-programmer, newbie with compiling Hi
I am new to Java world, I download java version j2sdk1.4.1_01 to my
computer, and install it
when I try to compile program from command line type javac tst.java, I got
the following error
"Exception in thread "main" java.lang.NoClassDefFoundError:
com/sun/tools/javac/Main"

however, I can use textPad to compile it, when I try to run from textPad, I
got same error:


Thanks advance
Libin


 
ribchr00





PostPosted: 2003-10-25 6:28:00 Top

java-programmer >> newbie with compiling How looks the code of tst.java? Post it please. Cheers,

richard

> Hi
> I am new to Java world, I download java version j2sdk1.4.1_01 to my
> computer, and install it
> when I try to compile program from command line type javac tst.java, I got
> the following error
> "Exception in thread "main" java.lang.NoClassDefFoundError:
> com/sun/tools/javac/Main"
>
> however, I can use textPad to compile it, when I try to run from textPad, I
> got same error:
>
>
> Thanks advance
> Libin
 
ameyas7





PostPosted: 2003-10-25 17:40:00 Top

java-programmer >> newbie with compiling "Libin Xie" <email***@***.com> wrote in message news:<3f991d18$email***@***.com>...
> Hi
> I am new to Java world, I download java version j2sdk1.4.1_01 to my
> computer, and install it
> when I try to compile program from command line type javac tst.java, I got
> the following error
> "Exception in thread "main" java.lang.NoClassDefFoundError:
> com/sun/tools/javac/Main"
>
> however, I can use textPad to compile it, when I try to run from textPad, I
> got same error:
>
>
> Thanks advance
> Libin

hi
its a question of classpath
make sure that you have included '.' in your classpath variable
& also path for required directories in classpath variable


regards
amey
 
 
HGA03630





PostPosted: 2003-10-25 18:15:00 Top

java-programmer >> newbie with compiling "Libin Xie" <email***@***.com> wrote in message news:<3f991d18$email***@***.com>...
> Hi
> I am new to Java world, I download java version j2sdk1.4.1_01 to my
> computer, and install it
> when I try to compile program from command line type javac tst.java, I got
> the following error
> "Exception in thread "main" java.lang.NoClassDefFoundError:
> com/sun/tools/javac/Main"
>
> however, I can use textPad to compile it, when I try to run from textPad, I
> got same error:
>
>
> Thanks advance
> Libin
If you use Windows, you need to:
(1)SET PATH=C:\j2sdk1.4.1_01\bin;%PATH%
in the AUTOEXEC.BAT
(2)SET CLASSPATH=.;%CLASSPATH%
in the AUTOEXEC.BAT
(3)Reboot the machine.
(4)Launch MS-DOS prompt and go to the directory where your .class and
.java files are stored.
(5)Do javac or java.

'.' in the CLASSPATH means current directory whatever it is.