newbie question with compiling

L

Libin Xie

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
 
W

winbatch

Try
java -classpath .; tst.java

(Textpad probably includes the current directory when compiling).

When running, add the classpath of . again.
java -classpath .; tst

(You can also add . to the CLASSPATH environment variable and not have to
worry about this again...)
 
N

Nils O. =?iso-8859-1?Q?Sel=E5sdal?=

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:
Something is screwd up in the installation(historically java hav had problems
if you install several versions of it , install the jre, then the sdk etc..)
Does java -version
show the version you expect ?
Does it help if you use the full path to javac ? e.g.
c:/j2sdk_whatever/bin/javac tst.java
 
L

Libin Xie

Thanks for your response, Nils
I got two version in my system, I thinks it's screw up
command "java -version"
F:\My Documents>java -version
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

Is there anyway I can edit this default path??I can compile program in this way
however, I still cant run this program, I got the same error message even I use full path for java

Thanks
Libin Xie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top