OpenJDK as Java Platform

From Gcube Wiki
Revision as of 02:56, 3 May 2019 by Manuele.simi (Talk | contribs) (Installation on Ubuntu)

Jump to: navigation, search

As of May 2019, OpenJDK 8 is the official Java platform supported by gCube. Legacy components still work on Oracle Java and are maintained, but active development is not done under this platform.

About OpenJDK

OpenJDK (Open Java Development Kit) is a free and open-source implementation of the Java Platform, Standard Edition (Java SE). It is the result of an effort Sun Microsystems began in 2006. The implementation is licensed under the GNU General Public License (GNU GPL) version 2 with a linking exception. Were it not for the GPL linking exception, components that linked to the Java class library would be subject to the terms of the GPL license. OpenJDK is the official reference implementation of Java SE since version 7.

Installation on Mac OS X

Software requirements:

Installation steps:

1) Add the distribution repository:

 
>$ brew tap AdoptOpenJDK/OpenJDK
 
==> Tapping adoptopenjdk/OpenJDK
Cloning into '/usr/local/Homebrew/Library/Taps/ adoptopenjdk/homebrew-OpenJDK'...
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 24 (delta 12), reused 12 (delta 5), pack-reused 0
Unpacking objects: 100% (24/24), done.
Tapped 14 casks (66 files, 81.8KB).

2) Look for available releases:

>$ brew search /adoptopenjdk/
 
==> Casks
adoptopenjdk               adoptopenjdk11-jre         adoptopenjdk12             adoptopenjdk12-openj9-jre  adoptopenjdk8-openj9
adoptopenjdk10             adoptopenjdk11-openj9      adoptopenjdk12-jre         adoptopenjdk8              adoptopenjdk8-openj9-jre
adoptopenjdk11             adoptopenjdk11-openj9-jre  adoptopenjdk12-openj9      adoptopenjdk8-jre          adoptopenjdk9

3) Install version 8:

>$ brew cask install adoptopenjdk8
 
==> Satisfying dependencies
==> Downloading ....
==> Verifying SHA-256 checksum for Cask 'adoptopenjdk8'.
==> Installing Cask adoptopenjdk8
==> Running installer for adoptopenjdk8; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:
installer: Package name is AdoptOpenJDK
installer: Installing at base path /
installer: The install was successful.
 
adoptopenjdk8 was successfully installed!

4) Verify that OpenJDK 8 is the default Java platform now:

>$ java -version
OpenJDK version "1.8.0_212"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_212-b03)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.212-b03, mixed mode)

Installation on Ubuntu

Software requirements:

Installation steps: 1) Install the package

$ sudo apt install openjdk-8-jdk

2) Set OpenJDK as default java platform

$ sudo update-java-alternatives -s java-1.8.0-openjdk-amd64

3) Verify that OpenJDK 8 is the default Java platform now:

$ sudo update-alternatives --get-selections
idlj                           manual   /usr/lib/jvm/java-8-openjdk-amd64/bin/idlj
jar                            manual   /usr/lib/jvm/java-8-openjdk-amd64/bin/jar
jarsigner                      manual   /usr/lib/jvm/java-8-openjdk-amd64/bin/jarsigner
java                           manual   /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
java2groovy                    auto     /usr/share/groovy/bin/java2groovy
javac                          manual   /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
...