Difference between revisions of "OpenJDK as Java Platform"
Manuele.simi (Talk | contribs) (→IntelliJ IDEA) |
Manuele.simi (Talk | contribs) (→Eclipse) |
||
Line 96: | Line 96: | ||
1) Open the menu ''Windows > Preferences''. In the dialog that opens, select ''Java > Installed JRE'' | 1) Open the menu ''Windows > Preferences''. In the dialog that opens, select ''Java > Installed JRE'' | ||
− | [[File:EclipseOpenJDK1.png| | + | [[File:EclipseOpenJDK1.png|350px]] |
2) Click on "Add Standard VM" | 2) Click on "Add Standard VM" | ||
Line 109: | Line 109: | ||
4) Open the menu menu ''Windows -> Preferences''. In the dialog that opens, select ''Java > Compiler'' | 4) Open the menu menu ''Windows -> Preferences''. In the dialog that opens, select ''Java > Compiler'' | ||
− | [[File:EclipseOpenJDK4.png| | + | [[File:EclipseOpenJDK4.png|400px]] |
5) Click on "Configure Project Specific Settings..." (to the top-right), you should see an empty list. | 5) Click on "Configure Project Specific Settings..." (to the top-right), you should see an empty list. | ||
Line 119: | Line 119: | ||
6.3) Select “Java Build Path” on left, then “JRE System Library”, click Edit… | 6.3) Select “Java Build Path” on left, then “JRE System Library”, click Edit… | ||
− | [[File:OpenJDK8.png| | + | [[File:OpenJDK8.png|400px]] |
6.4) Select "Workspace Default JRE" | 6.4) Select "Workspace Default JRE" | ||
− | [[File:OpenJDK7.png| | + | [[File:OpenJDK7.png|300px]] |
6.5) Confirm everything | 6.5) Confirm everything |
Revision as of 05:51, 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
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:
- 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 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 ...
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.