'''[http://openjdk.java.net/ OpenJDK]''' is an free implementation of Java for Linux, Solaris and Windows.[http://hg.openjdk.java.net/jdk7/build/raw-file/tip/README-builds.html#MBE OpenJDK Build README: Minimum Build Environments] There is also OpenJDK for BSD[http://openjdk.java.net/projects/bsd-port/ OpenJDK: BSD Port Project]. Several BSD and Linux distros carry packages of OpenJDK.

OpenJDK can compile and run Java programs. OpenJDK 6 implements Java 6, while OpenJDK 7 is a preview of future Java 7.

Usage

OpenJDK is a set of command-line tools. If OpenJDK is installed in /usr/local/jdk-1.7.0, then /usr/local/jdk-1.7.0/bin needs to be added to the PATH environment variable. The two most important tools are the javac compiler, and the java runner.

This example program would compute 12 - 4.

/* TwelveMinusFour.java */
public class TwelveMinusFour {
	public static void main(String[] args) {
		System.out.println(12 - 4);
	}
}

One can compile this program with javac, and run it with java.

$ javac TwelveMinusFour.java                                                   
$ java TwelveMinusFour                                                         
8

References