/usr/local/java1.2/bin/
This will be the version of the Java Development Kit that will be use
in EECS 370 this semester.
Make sure this directory is in your path. A simple way to check
this is to use the which command such as:
i370@oscar:~> which javac
/usr/local/java1.2/bin/javac
The above command shows the path location of the javac command you
would execute with
your current path settings. If the javac command is from the
proper directory, the path is set correctly.
Consider the following java program called HelloWorld.java:
// File: HelloWorld.java
// Sample simple java program. Required by law to be the first
// java program anyone every sees. :)
// To run. First compile the program
// $> javac HelloWorld.java
//
// Next, run the java interpreter specifying the HelloWorld class
// $> java HelloWorld
public class HelloWorld
{
public static void main (String [] args)
{
System.out.println ("Hello World!");
}
}
To compile the program type the command:
$> javac HelloWorld.java
To run the program, invoke the java interpreter specifying the HelloWorld class.
$> java HelloWorld