Java Reference
In-Depth Information
Operating system commands such as cd are helpful when compiling and running programs or
performing maintenance activities using the Command Prompt window. Table D-1 displays some use-
ful operating system commands you can use in the Command Prompt window to interact with the
Windows operating system.
Table D-1
Useful Operating System Commands
COMMAND
PURPOSE
cd directory name
Changes directory.
cls
Clears screen of previous commands.
copy path/filename path/filename
Copies one or more files from one directory to another directory.
date
Displays or sets the date.
del filename
Deletes a file or files.
dir
Displays a list of all files and subdirectories in the current directory.
help
Displays a listing of available operating system commands.
md directory name
Makes a new directory.
move path/filename path/filename
Moves one or more files from one directory to another directory.
path path
Clears all search path settings and directs Windows to search only in
the current directory.
rd directory name
Removes an existing directory.
ren oldfilename newfilename
Renames a file.
set classpath= path
Directs the Java SDK to look for classes in the specified path.
type filename
Displays the contents of a text file.
Pressing CTRL + C halts execution of any currently running command.
Setting the Path and Classpath Environment Variables
Recall that an environment variable is a string that lists information about the system environ-
ment, such as a drive, path, or file name. When compiling and executing from the command prompt,
no IDE or VATE software has direct control over compiling and executing; only the operating system
has direct control over compiling and executing. Therefore, it may be necessary to set a path to notify
the operating system where the Java SDK is located in order to compile programs. It also may be nec-
essary to set the classpath to specify the location of the Java classes in order to run the program.
The steps on the next page set the environment variables for the path and classpath at the com-
mand prompt. The steps set the path to the installed location of the Java SDK, as discussed in
Appendix B. The classpath will be set to the Appendices directory on drive A.
 
Search WWH ::




Custom Search