next up previous contents
Next: How to Type Commands Up: Unix1 Primer Previous: Getting Out   Contents

An Introduction to Programming with Unix

Here is an outline of the process you will follow to write a program:
  1. Log in.
  2. Use an editor (probably XEMACS) to create a file that contains your program. Later, you will also use the editor to make changes in the program.
  3. Use a compiler to process your program so that the computer can execute it. For java programs, you use ``javac''.
  4. To run your program, use ``java'', which is the interpreter for your compiled ``.class'' file.
  5. Repeat the last three steps until your program works.
  6. Log out by typing the command ``logout".
Here is an example of a complete programming session. $ ls *.java (see what C files I have.)
$ xemacs demo.java (create a new one.)
$ javac demo.java (try to compile it. A file ''demo.class'' will be created if successful.)
$ ls (see what files I have created.)
$ java demo (run your java program; note that there is no file extension her. You are actually running the ''demo.class'' bytecode.)
$ logout Notice that Unix types out a prompt (normally ``$") and expects you to type commands. These commands are normally English words or abbreviations of English words, followed by arguments. Here are some typical Unix commands: ls ( LiSt the files on your directory) Generally the Unix philosophy is to say as little as possible. If a command works, Unix just gives you another prompt. If something is wrong, you will get an error message. Please see section 7.3 for programming the system within EMACS.
next up previous contents
Next: How to Type Commands Up: Unix1 Primer Previous: Getting Out   Contents
Arthur Chou 2001-09-04