Java with Unix

You may develop your Java assignments using Unix. In fact, I encourage it: Doing this will ameliorate the shortage of Java-equipped Macintoshes, helping your classmates. (And maybe you prefer the command-line Unix environment to Macs.)

If you don't have Unix experience and you're not in CS lab or team projects, this document is not for you: The Unix environment is rather difficult to learn, and I'm not going to explain general techniques.

When you create your Java program, name the file ``ClassName.java''. Then you can compile your program using the simple command javac.

  % javac ClassName.java
If this is successful, your program will compile into ``ClassName.class''. To run the program, type
  % java ClassName

The Console.java used for Macintoshes will also work with Unix. It will create a separate window. To terminate the program, you can type control-C in the same terminal window where you typed, ``java ClassName.''

If you want your program to print into this terminal window rather than make its own separate window, you can use this alternative Console.java.

To hand your program in, you can highlight the entire program in Emacs and select ``Copy.'' Then you can ``Paste'' the selection in Netscape. (Alternatively, you can highlight the entire program in any window, go to Netscape, and click the second mouse button in the text field to paste it.)