Difference between revisions of "OpenJDK as Java Platform"
Manuele.simi (Talk | contribs) (→Installation on Ubuntu) |
Manuele.simi (Talk | contribs) (→OpenJDK Installation) |
||
Line 8: | Line 8: | ||
= OpenJDK Installation = | = OpenJDK Installation = | ||
− | == | + | == On Mac OS X == |
'''Software requirements:''' | '''Software requirements:''' | ||
* [https://brew.sh/ Homebrew] | * [https://brew.sh/ Homebrew] | ||
Line 53: | Line 53: | ||
adoptopenjdk8 was successfully installed! | adoptopenjdk8 was successfully installed! | ||
</source> | </source> | ||
− | 4) Verify that OpenJDK 8 is the default Java platform | + | 4) Verify that OpenJDK 8 is the default Java platform: |
<source lang="bash"> | <source lang="bash"> | ||
>$ java -version | >$ java -version | ||
Line 61: | Line 61: | ||
</source> | </source> | ||
− | == | + | == On Linux Ubuntu == |
'''Software requirements:''' | '''Software requirements:''' | ||
* [https://help.ubuntu.com/lts/serverguide/apt.html.en Advanced Package Tool, or APT] | * [https://help.ubuntu.com/lts/serverguide/apt.html.en Advanced Package Tool, or APT] | ||
Line 78: | Line 78: | ||
</source> | </source> | ||
− | 3) Verify that OpenJDK 8 is the | + | 3) Verify that OpenJDK 8 is the default Java platform: |
<source lang="bash"> | <source lang="bash"> | ||
$ sudo update-alternatives --get-selections | $ sudo update-alternatives --get-selections |
Revision as of 11:41, 3 May 2019
Contents
Java Platform
As of May 2019, OpenJDK 8 is the official Java platform supported by gCube. Legacy components work on JDK from Oracle and are still 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.
OpenJDK 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:
>$ 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)
On Linux Ubuntu
Software requirements:
- Advanced Package Tool, or APT
- sudo privileges for the current user
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:
$ 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 ...
IDE Configuration
Eclipse
The following steps explain how to configure OpenJDK as default Java Platform in Eclipse and how to set each project to use it.
1) Open the menu Windows > Preferences. In the dialog that opens, select Java > Installed JRE
2) Click on "Add Standard VM"
3) Browse to the OpenJDK installation folder and adjust the settings:
4) Open the menu menu Windows -> Preferences. In the dialog that opens, select Java > Compiler
5) Click on "Configure Project Specific Settings..." (to the top-right), you should see an empty list.
6) Then, for each project, follow these steps:
6.1) Open the project 6.2) Right click the project and select "properties" 6.3) Select “Java Build Path” on left, then “JRE System Library”, click Edit…
6.4) Select "Workspace Default JRE"
6.5) Confirm everything
IntelliJ IDEA
The following steps explain how to configure OpenJDK as default Java Platform in IntelliJ IDEA and how to set each project to use it.
1) Open the project to migrate.
2) Open the Project Structure dialog (menu File > Project Structure).
3) In the leftmost panel, under Platform Settings, click SDKs.
4) Above the panel to the right, click + and select JDK.
5) In the dialog that opens, select the installation directory of OpenJDK to be used and click OK.
6) If necessary, configure your custom profile and specify the preverify options on the SDK page (in the right-hand part of the dialog).
7) Click OK in the Project Structure dialog.