wiki:commandline
Last modified 8 years ago Last modified on 2009-09-18 09:36:06

Command line

Before you start programming with an Intergrated Development Environment (IDE) you have to familiarize yourself with the efficient use of command line.
ConTEXT - A good text editor with code highlighting for Windows

Some command line basics

u:                           - changes the current drive to drive U
mkdir DIRECTORY NAME         - makes a new directory
rmdir DIRECTORY NAME         - removes a directory
cd DIRECTORY NAME            - changes the current directory
cd ..                        - "changes to the previous directory"
dir                          - lists the content of the current directory
copy FILE NAME TARGET NAME   - copies a file
del FILE NAME                - deletes a file
U:\>cd \courses\ohj1\demos   - changes the current directory to the one given

Java with command line

Editing

  • Go to the directory of the program you want to edit:
    c:
    mkdir \mytemp\ohj1\john
    cd \mytemp\ohj1\john
    
  • Start the text editor you prefer and give a name for the file, for example:
    ct Hello.java
    
  • Write the content of the file you just created
  • Save the file but do not exit eh editor

Compiling

  • Go back to command line (Alt-Tab)
  • Type in the command for compiling
    javac Hello.java
    
  • If everything went fine you should have a file Hello.class
  • Check it:
    dir
    

Running

  • You can run the class file just made with a command "java className". Example:
    java Hello