Course Links

Exercises

Resources

External

This lab contains no programming content. It is designed to make sure that your account is set up properly and you are familiar with the requirements for writing and submitting Java programs.

Account Setup

Logging In From a Lab Machine
If necessary, read the tutorial on logging into your Linux account. You will need the sheet with the Unix account id (something like cs212a-xx) and password that you have been given.
Logging In From a Laptop
If necessary, read the tutorial on remotely logging into your Linux account. You will need the sheet with the Unix account id (something like cs212a-xx) and password that you have been given.
Emacs Configuration File (Optional)
The instructor recommends using emacs for text editing on aurora. To ensure that it is set up the same for everyone, you can download the following configuration file and place it in the home directory of your new account (your home directory has the same name as your course account id; the full path is something like /Users/classes/cs212a/students/cs212a-xx.) If you are viewing this document from a browser on a Smith machine that is running Linux, you can simply right-click on the link above and select Save As to save the file. This will bring up a window asking where you want to save the file; it should come up in your home directory by default. Make sure the file is named .emacs when you save it. If you are working on a laptop and connecting to aurora remotely, you will need to open an emacs window, paste the file into it, and save as .emacs. Alternately you can first save a local copy of .emacs on your laptop or workstation by right-clicking, and then use a secure file transfer program to move it to your course account home directory.

File and Directory Management

Every project (i.e., lab or programming assignment) you work on should be stored separately in its own directory in your account. (If you are more comfortable with Mac or Windows, you may think of a directory as akin to a folder.) Accordingly, you should make a directory called lab0 and make it active so that all further work will be put in there.

$ cd
$ mkdir lab0
$ cd lab0
$ pwd

In the example above, the $ represents the command line prompt provided by Unix. You should enter everything you see following it. The pwd command should return information showing the sequence of directories in which your lab0 directory is located. The directory at the level just above lab0 should carry the same name as your user id, and is called your home directory. When you first log in, it will be the active working directory, meaning that commands entered will apply to files therein by default. Your web browser will also probably try to save things by default in your home directory. The cd lab0 command changes the working directory to the lab0 directory just created. Should you ever need to make your home directory active again, just use the cd command with no arguments. (Note that if you execute the mkdir lab0 command more than once, you may end up with multiple directories named lab0 nested within each other, which can be confusing. Try to avoid this if possible.)

For simple projects, the setup above should suffice. Sooner or later, you may need to fix a problem or develop a more complex directory structure. If that happens, you should read the tutorial on file management. But for now, please proceed to the next section. (If your file organization becomes confused during this lab, please ask for help rather than trying to fix it yourself.)

Compiling, Running, and Submitting a Java Program

In addition to background and orientation material, every lab and assignment will contain a list of exercises to do and files which must be turned in. For this lab, you will compile and submit a simple Java console application. Use this source code: HelloWorld.java. If you are working on a Linux desktop you can simply save the link in your working directory; otherwise, you will have to follow a few more steps. Either paste the text into an emacs buffer, or save it on the machine where you are working and then transfer the file to your course account on aurora.

Pretend that you have just finished writing this files for an assignment, and complete the following steps:

  1. Compile the java source code: javac HelloWorld.java
  2. Run the program: java HelloWorld
  3. Submit HelloWorld.java as though it were going to be graded (since this assignment is Lab 0, you should submit your file to the lab0 directory): rsubmit lab0 HelloWorld.java
  4. If you have time, try creating a typescript showing the program being compiled and run. Submit that as well.

If you are working on a laptop using an integrated development environment like Eclipse, there will probably be icons or menu items to compile and run the program instead of the typed commands given above. However, the final submission steps must always be completed on aurora. Transfer your file there and log in remotely to submit.