This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
A new classpath set up under System properties > environment variables> system variables as
3.Trying to compile programs in MS-Dos
> I assume this converts it to a class file. c:\java\projects>javac Welcome1.java > but I keep getting �java\projects� is not recognizes as an internal or external command, operable program or batch file
4.In MS-Dos when I type c:\ javac Welcome1.java
States error : error cannot read : Welcome1.java
5.when I type just c:\java I get an usage output of Usage: java [-options] class [args�] <to execute a class> or java java [-options] �jar jarfile [args�] <to execute a jar file>
6.when I type c:\javac I get usage output of Usage: javac <options> <source files> Etc
>I would like to know if my classpath is correct. What should I type in MS-Dos to compile the program?
Originally posted by Rim Cha: I assume this converts it to a class file. c:\java\projects>javac Welcome1.java but I keep getting �java\projects� is not recognizes as an internal or external command, operable program or batch file
Is 'c:\java\projects>' the DOS prompt or are you actually typing that ? The error message suggests the latter which is wrong. All you need to type is
Joined: Aug 17, 2006
Hi when I type
error: cannot read: Welcome1.java 1 error
Joined: Aug 05, 2005
javac -classpath . Welcome1.java
The classpath option tells javac where to look for files. '.' is the current directory.
You should not put tools.jar in the CLASSPATH. In fact, you should not set the CLASSPATH environment variable at all. If it is not set, Java by default looks in the current directory for class files to run.
You should add the bin directory of the JDK to the PATH environment variable. The installation notes explain how to do that for different versions of Windows (see step 5 of the instructions).
After you did that, follow this tutorial to the letter to compile and run your first Java program: Hello World Tutorial
(Note, the tutorial says you need JDK 6, but it works exactly the same with JDK 5 and other older versions).