Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't compile "HelloWorld"

Status
Not open for further replies.

andypara

Programmer
Apr 25, 2002
32
GB
I have SDK1.4.1_01 and I'm typing this at the DOS propmpt :-

C>\sdk1.4.1_01\BIN\javac HelloWorld.java

I keep on getting :-

Bad Command or File Name

The class is called HelloWorld and I've even tried saving it in a directory called HelloWorld but still no joy.

I really want to get started! I've looked in Autoexec.bat and there's nothing in there about a classpath for Java. Perhaps this is the problem but maybe not.

Can anyone give me some specific pointers please?

Thanks.

 
The 'Bad Command or File Name' is referring to the 'javac' command because you have not told DOS where the 'javac.exe' lives.

In autoexec.bat you need to add something along the lines of (if C:\java\jdk1.4 is where your sdk lives - else ammend the path)

rem Locate java .exe commands :
PATH=C:\java\jdk1.4\bin;%PATH%

rem Locate java library class files
CLASSPATH=C:\java\jdk1.4;C:\java\jdk1.4\lib;C:\java\jdk1.4\jre\lib

And all should be well (remember to run autoexec once changes are made in order for the new paths to take effect). If you still get errors later like "Cant find BlaClass", then try adding the jre and lib directories to the pathh aswell ...

Enjoy!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top