Notes on Java

Short Version

Because Red Hat didn’t use to provide Sun Java, we would install and maintain it by hand, necessitating a page documenting where java was installed and how to include it in your path, but now that (as of mid-2007) Red Hat provides Sun Java, this system is deprecated.

/usr/bin/java{,c,etc} should point to the latest installed version of Sun Java tools on all public RHEL systems (which as of November 2008 is Java 1.6). /usr/bin/ should be in everyone’s default PATH, so you shouldn’t need to do anything special, just type java or javac (etc) to get the program you want.

If you want an older version of java, look in /etc/alternatives, which contains symlinks to various versions of software. To use java 1.5, for example, simply run /etc/alternatives/java_sdk_1.5.0/bin/java

Note that all of this information applies only to the Linux machines. On the Macs, java is installed with the Developer Tools package into /usr/bin/java and maintained by Apple. As of November 2008, Apple Java is still on version 1.5.

For historical reasons, the old java notes page is archived here. If you implemented any of the scripts that the old page suggested for our old setup, you can safely remove them, but they shouldn’t cause any harm if you leave them in place.

Long Version

These notes pertain to the use of Sun Java on machines running Red Hat Enterprise Linux:

Until approximately mid-2007, the license under which Sun Microsystems released their implementation(s) of Java was not considered compatible with redistribution by Red Hat, Inc, the vendor responsible not only for the core OS we run on our linux machines, but also for the vast majority of installed software on those machines.

As such, we (CS Systems Operations) would manually install and maintain working copies of Sun Java on all managed machines. Red Hat’s packaged version of the GNU Compiler for Java (GCJ) was accessible at /usr/bin/java, and our local installs of Sun Java were maintained under /usr/java.

Following Sun’s relicensing of (almost all of) Java, Red Hat now packages and distributes Sun’s Java, and all managed workstations installed during or after summer 2008 should have Red Hat packaged copies of Sun Java accessible via /usr/bin/java (maintained as a series of symlinks with the alternatives(8) system). Manually installed copies of Sun Java are now deprecated, and are being removed and replaced where they still exist.

To see which java command your shell invokes when you run java (you can always specify the full path to an alternate install if you don’t want to change your PATH or only need to make one-time use of an alternate java), run which java.

To see what version of java any given instance is, run java -version. Some examples of how different java versions appear:

Sun packaged (Manually installed) Sun Java:

$ java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)

Red Hat packaged GCJ:

$ java -version
java version "1.4.2"
gcj (GCC) 3.4.6 20060404 (Red Hat 3.4.6-10)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Red Hat packaged Sun Java:

$ java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Server VM (build 10.0-b23, mixed mode)

As you can see, the differences in output between Sun packaged Sun Java and Red Hat packaged Sun Java are minimal, as they are both distributions of the same code. The reason for this change in how we install and maintain java is threefold:

If you have need for an older java, a specific point release, or some piece of information not listed above, please do not hesitate to contact guru for assistance.


Valid XHTML 1.0
Strict

Last modified: September 6, 2007

guru@cs.brandeis.edu