CSC148H/A48H -- Essential DOS commands


DOS basics

There are usually two ways to interact with a filesystem: using a GUI (Graphical User Interface) where you point and click, and using a command line where you type commands. In Windows, the command line is called "DOS".

To open a DOS window in the St. George labs, click on Start -> Command Prompt.

Use the following commands to navigate through the directory structure:

command effect
dir list contents of current directory
h: go to drive H
cd dirName go to directory "dirName"
cd.. go up to parent directory
cd \ go to root directory
dir list contents of current directory
del llama delete file called "llama"
ren llama alpaca rename file or directory "llama" to "alpaca"
md eek make a new directory called "eek"
rd eek remove the directory called "eek"

Click for an exhaustive list of DOS commands. (This is not required reading.)

Note: DOS is not case sensitive but Java is. For example, Java knows that hello, HELLO and hEllO are not the same. DOS is not as clever.


Compiling, Running and Documenting Java Programs

Although you will likely have already compiled your code from within DrJava, you can also do it from DOS. Type

      javac Marf.java
    

at the prompt, where Marf.java is the java source file.

To run a Java program type

      java Marf
    

Where Marf is the name of the class containing the program's main method. Note: Do not type the .class or .java extension.


Javadoc from the command line

You can run javadoc either by changing directories (with cd) or by specifying the absolute path to the source files. The following generates the documentation for all the .java files in the current directory:

      javadoc -private *.java
    

The -private flag generates documentation for the private members of your classes as well as public members. This is appropriate when generating documentation for other programmers who will maintain your code, and may be required for assignments.

Click for detailed documentation for JavaDoc. (This is not required reading.)