Table of Contents
Introduction
This page is based on experience of setting up the Open JDK 8 on Ubuntu 14.04. Much of it may be applicable to other Java versions and distros.
Installation
Run the following commands in order to install or update the Open JDK 8.
sudo add-apt-repository ppa:openjdk-r/ppa sudo apt-get update sudo apt-get install openjdk-8-jdk
Plugin
In this example the Mozilla plugin is missing. This is not a big problem if you don't want to use for security reason.
In case you want to install it, here is the procedure to get it. At the time we wrote this guide the icedtea-8-plugin is not available in the standard repository.
sudo add-apt-repository ppa:maarten-fonville/ppa sudo apt-get update sudo apt-get install icedtea-8-plugin
As we installed a new java component we need to re-run the update-java-alternatives command:
sudo update-java-alternatives -s java-8-openjdk-i386
Some problem can happen depending the sequence and the way you try to achieve this task. I face some issues with missing or wrong symbolic link.
Here is the output of our /usr/lib/jvm directory :
user@machine:~$ cd /usr/lib/jvm user@machine:/usr/lib/jvm$ ls -al total 88 drwxr-xr-x 6 root root 4096 Apr 19 15:39 . drwxr-xr-x 210 root root 53248 Mar 31 07:41 .. lrwxrwxrwx 1 root root 23 Apr 19 15:39 default-java -> java-1.8.0-openjdk-i386 lrwxrwxrwx 1 root root 19 Mar 5 2013 java-1.6.0-openjdk-i386 -> java-6-openjdk-i386 -rw-r--r-- 1 root root 2345 Jan 26 23:05 .java-1.6.0-openjdk-i386.jinfo lrwxrwxrwx 1 root root 19 Apr 8 2014 java-1.7.0-openjdk-i386 -> java-7-openjdk-i386 -rw-r--r-- 1 root root 2396 Mar 24 16:46 .java-1.7.0-openjdk-i386.jinfo lrwxrwxrwx 1 root root 19 Jan 29 06:25 java-1.8.0-openjdk-i386 -> java-8-openjdk-i386 -rw-r--r-- 1 root root 2501 Jan 29 06:25 .java-1.8.0-openjdk-i386.jinfo drwxr-xr-x 3 root root 4096 Mar 12 2013 java-6-openjdk-common drwxr-xr-x 7 root root 4096 Feb 13 09:18 java-6-openjdk-i386 drwxr-xr-x 7 root root 4096 Mar 25 07:59 java-7-openjdk-i386 drwxr-xr-x 7 root root 4096 Apr 19 13:04 java-8-openjdk-i386 lrwxrwxrwx 1 root root 30 Apr 19 15:28 .java-8-openjdk-i386.jinfo -> .java-1.8.0-openjdk-i386.jinfo
The default-java should be linked with your desired JVM and also a .default-java.jinfo should be linked as well to your desired JVM jinfo file.
The command update-java-alternatives complained also with a missing .java-8-openjdk-i386.jinfo file. I created an appropriate link towards the existing .java-1.8.0-openjdk-i386.jinfo file.
Java Source
When I've installed the Open JDK 8 I realized that the Java source code was not available. Usually below you default-java directory you should see a src.zip file. In my case the src.zip file was a reported broken link towards ../openjdk-8/src.zip.
Run the following command :
sudo apt-get install openjdk-8-source
While installing a java component the command can give a few hints :
user@machine:~$ sudo apt-get install openjdk-8-source [sudo] password for user: Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: linux-headers-3.13.0-79 linux-headers-3.13.0-79-generic linux-image-3.13.0-79-generic linux-image-extra-3.13.0-79-generic Use 'apt-get autoremove' to remove them. The following extra packages will be installed: openjdk-8-jdk openjdk-8-jdk-headless openjdk-8-jre openjdk-8-jre-headless Suggested packages: openjdk-8-demo visualvm openjdk-8-jre-jamvm fonts-ipafont-gothic fonts-ipafont-mincho ttf-telugu-fonts ttf-oriya-fonts ttf-kannada-fonts ttf-bengali-fonts The following NEW packages will be installed: openjdk-8-jdk-headless openjdk-8-source The following packages will be upgraded: openjdk-8-jdk openjdk-8-jre openjdk-8-jre-headless 3 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 81.2 MB of archives. After this operation, 52.1 MB of additional disk space will be used. Do you want to continue? [Y/n]
In that case an sudo apt-get autoremove is suggested and additional packages are also suggested.
We have also an idea of the openjdk-8-source estimated size of 52,1 MB. Once installed I got a new directory below my /usr/lib/jvm directory. The openjdk-8 directory exists and contains the needed src.zip file thus fixing the reported broken link.
Enjoy