December 16, 2011

OpenJDK is by far the path of least resistance on a Fedora System.

Some OpenJDK History and Background

In 2006, Sun announced that it had intentions of releasing the source code for Java to the open source community, and in fact did so in May of 2007. At that time about 4 percent of the source could not be released under GPL, and Fedora initiated a project known as "Iced Tea" to work on replacing the missing pieces. In April of 2009, this goal was reached. The product of this project is what is now known as OpenJDK (and is still sometimes referred to as "Iced Tea", but this name seems to be fading from use).

It is important to note that OpenJDK is not some offbeat alternative Java project (at least not at this point in time), but it is the Java source released by Sun, with the requisite additions to make it fully open source.

Also it is important to point out that JDK 6 is also called 1.6.0. Similarly JDK 7 is called 1.7.0. I don't have a clue why these two parallel numbering schemes are in use, but I don't think it is a great idea. Note that JDK 6 tracks Java 6 from Sun, and JDK 7 tracks Java 7 from Sun (actually now Oracle).

OpenJDK 1.6.0 on Fedora 16

I just finished a fresh install of Fedora 16, and wanted to see what flavor and version of java was installed for me (if any).

Typing java -version gives me:

 java version "1.6.0_22"
 OpenJDK Runtime Environment (IcedTea6 1.10.4) (fedora-61.1.10.4.fc16-x86_64)
 OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

Typing the command "javac -version" tells me that I do not have javac.

I type the command yum list | grep java and get the following:

java-1.5.0-gcj.x86_64                   1.5.0.0-37.fc16              fedora     
java-1.5.0-gcj-devel.x86_64             1.5.0.0-37.fc16              fedora     
java-1.5.0-gcj-javadoc.x86_64           1.5.0.0-37.fc16              fedora     
java-1.5.0-gcj-src.x86_64               1.5.0.0-37.fc16              fedora     
java-1.6.0-openjdk-demo.x86_64          1:1.6.0.0-61.1.10.4.fc16     updates    
java-1.6.0-openjdk-devel.x86_64         1:1.6.0.0-61.1.10.4.fc16     updates    
java-1.6.0-openjdk-javadoc.x86_64       1:1.6.0.0-61.1.10.4.fc16     updates    
java-1.6.0-openjdk-src.x86_64           1:1.6.0.0-61.1.10.4.fc16     updates    
java-1.7.0-openjdk.i686                 1:1.7.0.1-2.0.3.fc16         updates    
java-1.7.0-openjdk.x86_64               1:1.7.0.1-2.0.3.fc16         updates    
java-1.7.0-openjdk-demo.x86_64          1:1.7.0.1-2.0.3.fc16         updates    
java-1.7.0-openjdk-devel.i686           1:1.7.0.1-2.0.3.fc16         updates    
java-1.7.0-openjdk-devel.x86_64         1:1.7.0.1-2.0.3.fc16         updates    
java-1.7.0-openjdk-javadoc.noarch       1:1.7.0.1-2.0.3.fc16         updates    
java-1.7.0-openjdk-src.x86_64           1:1.7.0.1-2.0.3.fc16         updates    
I intend to ignore the gcj packages (gnu compiler for java). A guiding light in this is the following statement from the Fedora Java FAQ:
Eventually at some point OpenJDK will replace GNU Java completely.
I note that I can (and must) choose explicitly between the 1.6.0 and 1.7.0 versions of openjdk.

Why would I want to have anything to do with 1.7.0 and why does Fedora provide 1.6.0 instead of 1.7.0 by default on a new install? At this point I have no idea.

Installing the development packages

As noted above, it is necessary to choose explicitly between the 1.6.0 and 1.7.0 versions of openjdk. It is not possible to just install "openjdk-devel".

I do this:

yum install java-1.6.0-openjdk-devel
After this I can do:
[root@cholla tom]# javac -version
javac 1.6.0_22
I also do:
yum install java-1.6.0-openjdk-demo
yum install java-1.6.0-openjdk-javadoc
This gives me a fully working install of OpenJDK 1.6.0 to try out.
Have any comments? Questions? Drop me a line!

Adventures in Computing / tom@mmto.org