Java Reference
In-Depth Information
Programmers note:
It is usually a good idea to execute the Java compiler from the same di-
rectory where the source files are located. This ensures that the sys-
tem can find the source files.
Proceed as follows to compile the HelloJava program:
1. Open a window with the MS DOS command prompt. If there is no MS DOS
icon on your Windows desktop, you can find the MS DOS command prompt
in the Programs command of the Windows Start menu.
2. Log on to the directory where the source file that you intend to compile is
located.
3. Execute the Java compiler from the MS DOS command prompt.
In the case of the HelloJava program, the command will be:
javac HelloJava.java
Javac (usually pronounced java-see) is the name of the Java compiler.
If compilation takes place correctly, no error message is displayed and
the MS DOS command prompt returns to the screen. If the javac compiler
produces an error, you will have to locate it in the source code and cor-
rect it before attempting to re-compile.
Figure2-3 showstheMS-DOSpromptwindowduringthecompilation
and execution of the HelloJava program.
Figure 2-3 Compiling and Executing the HelloJava Program
 
Search WWH ::




Custom Search