This document gives basic ways to run the programming language Java at Iowa State University in the Department of Computer Science. It also describes how to get Java for other computers.
Contents:
The latest Java Development Kit (JDK) for HP-UX is available from HP's Java page.
Our machines have a recent version of the JDK installed; the exact version varies with the operating system version of HP-UX.
The interpreters and tools are found in /opt/java/bin, so you must have this directory in your shell's PATH. In this directory, there are (at least, the following tools).
The basic cycle for using the interpreter on an application (a program) is as follows.
% emacs MyProgram.java
% javac MyProgram.java
% java MyProgram
In this example, it is assumed that emacs
is your editor and that the file MyProgram.java
contains a class named MyProgram with a
public static void method named main.
If you instead write an applet, you'll have to use the appletviewer or a java-enabled browser. The basic cycle is as follows.
% emacs MyApplet.java
% javac MyApplet.java
% emacs MyApplet.html
% appletviewer MyApplet.html
This example again assumes that emacs
is your editor. It also assumes that the file MyApplet.java
contains a public class named MyApplet with a
public void method named paint.
See a book on Java for details on the HTML file MyApplet.html.