Fundamentals of Computer Science II (CSC-152 99S)


Using Java on the MathLAN Network

There are two basic steps to running a Java program; you must compile the program and then interpret the compiled program. Compilation verifies the syntax of your program and translates your program into a language that the computer can more easily understand. The interpreter then executes this more easily understandable language.

To compile a program named XXX.java, type

% /home/rebelsky/bin/jc XXX.java

The ``jc'' stands for ``Java compiler''. If there are no observable errors in your program, you will see another prompt after about one minute. If there are observable errors in your program, the compiler will print a list of line/error pairs. Most people find the error messages unreadable, so feel free to ask me for help understanding them.

When compilation succeeds, the compiler creates a file called XXX.class. You can confirm this by typing

% ls

To execute the compiled program, type

% /home/rebelsky/bin/ji XXX

The ``ji'' stands for ``Java interpreter''.

If you get sick of typing /home/rebelsky/bin, add the following line to your .cshrc file.

set path = (/home/rebelsky/bin $path)

Afterwards, close your terminal window and open another one. From then on, you can use just ji and jc. Ask Sam or a tutor if you need help with this.


If you are importing classes such as SimpleInput and SimpleOutput, it is likely that you will need to make copies of those classes in the current directory. (Later in the semester we'll talk about how to create your own library of standard classes.)


Note that you are running special scripts designed for my class. If you would prefer to execute the actual Java compiler and interpreter, you'll need to make a few changes to your .cshrc file (this is only for more advanced students). The standard java compiler is called javac. The standard java interpreter is called java. Both can be found in /usr/local/java/bin

In order to use these, you will probably want to do the following.


A few helpful Unix hints:


Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.

This page may be found at http://www.math.grin.edu/~rebelsky/Courses/CS152/99S/Handouts/java-use.html

Source text last modified Fri Jan 29 10:11:37 1999.

This page generated on Fri Jan 29 12:18:25 1999 by SiteWeaver. Validate this page.

Contact our webmaster at rebelsky@math.grin.edu