CS479 Java Programming, Fall 1997

Instructions for using Java in the J. Mack Adams lab., SH118

Machines

Java can run on two platforms in the CS domain: Solaris (SUN/UNIX) and Macintosh. We also have it running under Linux, but since this version is not supported by Sun, we will not be using it in the class.

The Macintosh cluster is to the left of the main doors as you enter the lab from the main corridor leading from the entrance lobby. There are four large-screen 8500s that we will not be using, but beyond them are eight 6320s (four on the same table and four on the next table) with smaller screens. All these have Java 1.0.2 installed on them.

The Solaris machines can be reached through any of the UNIX machines located to the right as you walk in the doors. There are ten PCs all running Linux, and a mixture of SPARC IPCs, IPXs and X-terminals which allow access to any computer on the network. None of the machines in the lab run Solaris, but any of them can be used to log into a Solaris machine.

Switching on

All the UNIX machines are left on permanently. The Macs can be switched on by pressing the key at the top-right of the keyboard marked with a left-facing triangle, and holding it down until you hear a musical chord announcing that the machine has started. Make sure that the monitor is also on; it shows a green light when it is. The Mac operating system will then start loading and eventually the "At Ease" screen will appear.

Logging in

The Macintoshes are all open machines and anyone can log into them without a password (see "Security" below). However, they are all fully networked, and through them you can have access to the whole CS domain. The Linux machines give you a black "command line" screen with a login prompt. Your CS account will allow you to log into these machines and then run a windowing system (the standard is obtainable with the command "xstart") to give you access to other machines, and to run the Netscape browser. All of the non-Linux machines (basically everything except the PCs) gives you a menu of machines to log into. One of these, a machine called Sioux, runs Solaris; all the others are the Linux machines. You can thus log into a Solaris machine directly or indirectly through a Linux machine. The names of the Solaris machines (along with all the others) are listed in the department's intranet at http://intranet.cs.nmsu.edu/COG/Hardware/hosts.html, but you need to run Netscape to see this (see "Browsing with Netscape" below).

Security

UNIX is a fully secure operating system that will not allow random acts of negligence or abuse to its file systems. In addition, you need a password to log on at all. However, the Macintoshes are not secure, so we have installed a partial security system called "At Ease" on them. When you start the Macintosh a login screen will greet you. Select "student" and you will be presented with a system folder, with a brown background, which contains all the applications you can run, and a student folder that you can use for holding files as you work. Be aware though, that there is no security in the student folder. These files will probably disappear unless you make an effort to save them (see "Saving Files" below).

Browsing with Netscape

On a UNIX machine, typing "netscape&" at the prompt will bring up a browser screen. If this does not work, either you have not started a windowing system, or your environment is wrongly set up. In these cases, ask someone to help.

On the Mac, the At Ease folder contains an icon for netscape. Clicking it once with the mouse will bring up the browser window, and then you can type the URL of any site and start browsing.

The netscape browser also includes an email system. You may not want to use it for your main mail reader, but you can certainly use it to read mail for the Java class assignments when you are using the Macintosh. You probably want to set the option to leave the mail on the mail server before you run it, so you can re-read the mail on your main (UNIX) machine.

Creating source code files

On UNIX, use xemacs in the windowing system. Help is available for emacs in the editor, but I have a cheat sheet for the basics if you need it. On the Macintosh, use Simple Text, which you find on the second page of the At Ease folder. As its name implies, it is very simple to use, and adequate for writing simple programs. Always use a .java extension on the file name on both platforms.

Saving files

On UNIX, save your files to your own directory. On the Macs, you can save your files to the student folder, but they are not secure. You can either copy them to a floppy disk (the easiest and safest), or use FTP to copy them to you UNIX files space. FTP is part of the NCSA telnet program in the At Ease folder. In order to test Java on both platforms you will either have to create files on UNIX and copy them over to the Mac, or vice versa.

Running Java

On UNIX, you will need to add the follwing line to your .cshrc file:

source /local/config/cshrc.java

Then you can compile your .java file with:

% javac MyClass.java

and run it with:

% java MyClass

for standalone applications, or:

% appletviewer MyClass.html

for applets, where you have created a minimal .html file with the embedded tag <APPLET CODE="MyClass.class">.

On the Mac, run each application in turn, selecting the appropriate file using the File menu. We cannot use the technique in out textbook because access to the Desktop is prevented by At Ease.

Reading UNIX files on the Macintosh

Run the Chooser (from the "apple" menu in the top left-hand corner of the screen). Click on "Appleshare". Choose "radon" from the list and you will get a login screen. If your password is accepted, you can select the new mounted directory and close the Chooser. Your UNIX directory is now available at the Desktop level. For instance you can open a UNIX file in Simple Text by navigating to the directory (it has your UNIX login name) in the File Open dialog. Note that you cannot save files to the directory. Be careful to "eject" the mounted directory ("Special" from the At Ease screen) before you switch off, otherwise the next user might gain access to your files!

Logging out

Always, always, always log out from a UNIX machine before you walk away. If you have trouble doing this, get help. Many account break-ins are caused by students walking away when they are still logged in.

Always switch off the Macintosh before walking away. You may also want to erase your files from the Student folder after copying them to a floppy if you want to preserve them. If you have mounted your UNIX file system, "eject" it, then you can switch off using the "Shutdown" from the "Special" menu from the At Ease screen.