About Java

The environment necessary to program and run Java applications is provided on all ITS UNIX hosts. While ITS supports the use of the Java tools, ITS does not support programming syntax or program debugging in any way.

Setting up your Environment

There are multiple Java environments available on the USC Solaris systems. It is recommended that you use the Java Development Kit found in /usr/usc/jdk/. There are several different versions in that directory. It is suggested that you either the version required by your program or class, the default version, or the new version. ITS recommends that you use the default version.

To set up your environment to use the Java tools in the default version of JDK, type the following command:

source /usr/usc/jdk/default/setup.csh

To avoid typing in this command for every UNIX session, add that command to a new line at the end of your ~/.login file.

Using Java

To make a Java program, you must first create a program source file. To create this file you will need to use a text editor. A sample file is provided at the end of this document to get you started. Once you have your .java source file, you must convert it to an executable JAVA .class program with the javac command. If your source file were called myProgram.java, your command would be javac myProgram.java. Once your .class file is built, you can run it with the java command. Even though javac creates a file like myProgram.class, leave off the .class extension. So to run the .class file created from myProgram.java, type java myProgram.

Sample Program

Here is a sample program to get you started with JAVA. You can copy it into a file called myProgram.java, or you can download it here

import java.io.*;

public class myProgram


public static void main(String ARGS[]){

String printout=new

String("This is a Java Program.\n\n");





Other Tools

There is an appletviewer application installed in the JDK directory which can be used to view Java applets embeded into html pages. If you embeded your applet in a file called appletHolder.html, the syntax would just be appletviewer appletHolder.html.

Getting Help

There are manpages for java and javac that explain their syntax. There are Java resources on the Internet, including www.oracle.com/technetwork/java/index.html. If you are programming for a class, please ask your TA or professor for help with Java programming syntax.

While the ITS Customer Support Center can help with the basic use of the Java tools, ITS does not support programming syntax or program debugging in any way. ITS will accept reports that these tools are not functioning properly. Contact the ITS Customer Support Center.