University of Rochester Computer Science

Computer Science 171: Computer Programming

Home
Contacts
Labs
Lab Times
Lectures
Links and How To's
Projects
Programming Standards
(A.K.A. how to get a good grade on projects)
Schedule
Syllabus
Turn In (How to)
Workshop Times
WebCT (Grades)

Unix Tutorial

On UNIX (i.e. troi) J++ does not exist. Instead, to use Java you need to use JDK, which is Sun's Java compiler (which uses the standard, by the way, the rest of the world uses, except Microsoft and J++). JDK also exists for Windows and is freeware. Look at the Sun Java Site for more details.

JDK does not have an IDE (integrated development environment) like J++. This means there is no nice program that let's you edit files, compile, and run, all from the same program (which is what an IDE is). Rather, you have to do things separately yourself using smaller tools (which is what UNIX is usually like).

Editing files
There are several programs on UNIX that you can use to edit text files. The most popular are emacs, vi, and pico. If you don't know any of these, I would suggest that you use pico for now, but invest some time sometime in using emacs. It's not easy to learn to use, but most computer geeks use it (although a lot of people may flame me and say that vi is better, there is a huge religious war out there about if emacs or vi is better) Note, you either need xwindows to run emacs or run the command line version (use emacs -nw)

To use pico just type pico and the name of the file you want to edit. This is the same editor used for pine, so you are probably somewhat used to it.

Compiling your program
To compile a file use javac. The syntax is javac < name of file.java> So, for example, to compile a file called Class1.java run
javac Class1.java
This will create a .class file for that file. You need a .class file for each .java file.

Running your program
To run your program use java. The syntax is java < name of class>. So if my main function was in a class called Class1 then I would call
java Class1
to run my code. Note that for compiling you include the extension, but for running you do not.

Newsgroups NEW!!!
To access the course newsgroups:
1. Telnet and log into mail.rochester.edu
2. type pine
3. Select "Folder List" from the menu
4. Choose the news folders
5. type A to add a new newsgroups
6. enter ur.cs171
7. confirm
8. Select the appropriate newsgroups and enjoy

Alternatively you can use Outlook Express or any other third party program.
    The news server is:   news.cc.rochester.edu
    There is no login/pass needed
    Subscribe to "ur.cs171"

Other issues
In JDK, the name of a class (in the code) must be exactly the same as the filename (minus the .java extention of course). In UNIX filenames are case sensitive so make sure the case matches too.

Java and Other Reference Links

This page is here to help point you to a few sites on the web that are good references for Java and other stuff (in order of my thinking how useful they are). Please let us know if you have more that you'd like to add.

  1. Unix Tutorial
  2. Sun's Java API specification. Has a list of every class and every method that Java has. The ultimate reference.
  3. Sun's Java tutorial. Tutorials on everything from basic Java to writing Applets to networking to graphics to sound to security to you name it.
  4. Search the tutorial.
  5. Sun's Java Homepage. All of Sun's Java stuff, but really hard to find what you're looking for.
Updated 07-Sep-2003 16:45