A
Java Course Outline
Using the Java By Dissection
book
by Ira
Pohl and
Charlie McDowell
Editing, Compiling and Running a Program on a UNIX System
This section contains general information about things you will need to know how to do in order compile and run your Java programs on a UNIX system.
There are many aspects to creating and running programs. Generally speaking three required basic steps are
UNIX Editors
For the first step we use a editor. You may have several choices of editors available to you on your workstations: pico, emacs and vi are the editors most commonly used.
emacs
To run emacs simply type emacs
at the UNIX
prompt. On the sparcstations you should type emacs &
(the ampersand
will allow you to type additional UNIX commands in the xterm window because
emacs will create its own window). It will tell you how to run the tutorial
(Ctrl-h t) which you should do soon, though you can probably get through the
first labs without it.
For the first homework assignment all you n
pico
pico is probably the easiest editor to learn (it is very
similar to pine). The set of possible commands is much more restricted though
when compared to emacs. If you want to give the editor a try, just type pico
at the prompt sign, and start typing your program.
Some very basic key sequences are
vi
Check out the UCSC webpage about Software: Vi
Compiling and Running a Program
These instructions are for the standard/free JDK from
Sun Microsystems. You will use any editor and then run javac
to
compile your program and java
to execute it as described below.
cd
to the directory containing your Java source file, e.g. MyClass.java
.
You compile a java program with javac MyClass.java
.
java MyClass
(no extension) where MyClass
is the name of a class that contains a method main()
.
There is an online tutorial, Nettrail, for learning about using The Web, e-mail, newsgroups, and Melvyl (the electronic library information system) at UCSC.