Вы находитесь на странице: 1из 3

Basic MS-DOS Commands for CSCI Students

Essential Commands
dir Lists names of files in current directory (folder)

dir Hello.* Lists all files whose names start with Hello.

cd C:\files Changes directory to C:\files ("absolute" pathname)

Changes directory to myfiles subdirectory of current directory ("relative"


cd myfiles
pathname)

cd .. Changes directory to "parent" of current directory

notepad Hello.java MS-DOS text editor, used to create and edit ASCII textfiles

type Hello.java Displays contents of ASCII textfile on screen

exit Ends command interpreter, makes console window go away...

Useful File Management Commands


copy Test1.java Test2.java Copies contents of Test1.java to new file Test2.java

ren Test1.java Test2.java Renames Test1.java to Test2.java

del Test1.java Deletes Test1.java (Be careful with this command...)


copy Test1.java Test2.java Copies contents of Test1.java to new file Test2.java

Deletes all files with Test1 prefix (Be even more careful with this
del Test1.*
command...)

mkdir playpen Creates new directory playpen as subdirectory of current directory

rmdir playpen Removes directory playpen (must be empty)

Commands for Compiling and Running Java Applications

Note: if the commands in this table are not recognized by the MS-DOS command interpreter on your system, try using the path
commands listed below...

Compiles Java source file Hello.java (ASCII textfile),


javac Hello.java
produces bytecode file Hello.class (binary file)

"Runs" Java application: starts Java Virtual Machine (interpreter),


java Hello
which executes Java bytecode instructions in file Hello.class

Using javadoc to Document Java Classes

Note: if the commands in this table are not recognized by the MS-DOS command interpreter on your system, try using the path
commands listed below...

Generates Web document Cat.html, containing description of Cat class.


javadoc Cat Complete documentation requires inclusion of javadoc comments (/** .. */) in
source code.
Jar (Java Archive) Commands

Note: if the commands in this table are not recognized by the MS-DOS command interpreter on your system, try using the path
commands listed below...

Creates Pets.jar, containing compressed version of Pets folder and all its
jar cf Pets.jar Pets
contents

jar tf Pets.jar Displays list of zipped files in Pets.jar

jar xf Pets.jar Extracts (unzips) entire contents of Pets.jar, preserving any directory structures

Commands for Manipulating Environment Variables


Displays current value of PATH
path environment variable (list of directories
containing DOS command programs)

Adds named directory (a JDK system


directory in this example) to current
set path=C:\Program Files\Java\jdk1.6.0_15\bin;%PATH%
PATH environment variable (applies
only to current session).

Вам также может понравиться