Selasa, 26 Februari 2013

COMMAND PROMPT

What is Command Prompt?

A : Hey guys, can you explain to me what is Command Prompt?
B : Oh, here let me explain to you as clearly as I can.

The Command Prompt is a program allow you to work in an environment that looks more like a traditional operating system as opposed to the icon based Windows environment. In Command Prompt, you will use your keyboard. You won't use your mouse at all. Command Prompt works at a lower level than Windows. This means that you will have more control over the machine. The disadvantage is that it is less user-friendly.You will need the command prompt in COS 126 to use and execute your Java programs. Learning the Command Prompt also provides a great transition to Unix and Linux systems, which are gave advantages in science, engineering, and industry.

To launch Command Prompt select Start -> Run and then you type 'cmd' in the box. (without ' ' signs)

The Command Prompt shows up as a black terminal window. The command prompt should look something like:

    C:\>

This is where you type commands. The boldface type below (that follows the command prompt) is what you should type as you work through this tutorial. Windows does not care if you use upper or lower case. That means that command cd is the same as CD. It also means that, in Windows, file HelloWorld.java is the same as helloworld.java. This is NOT true in the system to which you will be submitting your files. Be very careful!!!

How To Use It?

A : And then, after all, how can I operate the command prompt guys?
B : Okay, for further explanation read some text below

You can also use Command Prompt commands to organize files into a directory hierarchy. These commands are equivalent to corresponding commands that you access via the Windows point-and-click interface. It is useful to be familiar with both interfaces for managing files.

    * javac:  To compile a Java program, use the javac command. Your program should compile without any errors or warnings (or if there are warnings be absolutely sure that they do not indicate a flaw in your program).

          C:\>javac HelloWorld.java

    * java:  To run a successfully compiled Java program, use the java command.

          C:\>java HelloWorld

    * more:  Display the contents of a file one screenful at a time.

          C:\>more HelloWorld.java
   
   * dir:  To view the contents of a directory, type dir. This command will list all the files and directories within the current directory. It is analogous to clicking on a Windows folder to see what's inside.

    * exit:  Exit the Command Prompt program and close the terminal window.

          C:\>exit

    * cd:   It is frequently useful to know in which directory you are currently working. In order to find out, type cd at the command prompt.

    * mkdir: To create a new directory, use the command mkdir. The following command creates a directory named hello, which you can use to to store all of your files associated with the Hello World assignment.

    * move: Now, move the two files HelloWorld.java and readme.txt into the hello directory using the move command.


.. and so on

What it's like?

A : After some explanation about Command Prompt, would you show me the lay out please?
B : Oh, here I already took some picture of them. See my other post :)