Java15 Dec 2015 • Leave Comments
There are three different editions of the Java platform: Standard Edition (SE), Enterprise Edition (EE), and Micro Edition (ME).
Most of the time, we require the SE version. Currently, version 7 is most widely deployed.
There are two different Java implementations: OpenJDK and Oracle Java.
They mostly depends on the same code but OpenJDK is fully open source while Oracle Java contains some proprietary binaries. Most Java applications work fine with either implementation.
There are two different Java packages: JDK and JRE.
Java Development Kit (JDK) for Java development (programming) while Java Runtime Environment (JRE) to run Java application. JDK includes JRE. So when installing JDK, there is no need to install JRE any more.
IcedTea Open Java SE, Sun's Java 6 SE, Oracle's Java 7/8 SE, IBM Java SE, etc.
- Oracle's Java is previously called Sun Java (<= version 6) that was acquisited by Oracle, Inc.
- IcedTea can be consireded a distribution of OpenJDK. In most GNU/Linux systems, OpenJDK is released as IcedTea, though the release is still named as OpenJDK.
Oracle's Java 8 SE is released at the time of writing this post but some new features make it incompatible with priori versions.
However, Oracle's Java 7 SE is vulnerable in spite of its efforts to release patches. If you really like Oracle's Java, use version 8 instead!
IcedTea Open Java SE
~ # emerge -pvt virtual/jdk # -or- ~ # emerge -pvt virtual/jre
Oracle's Java SE
Though Oracle Java SE is unfavorable, this section just shows how to install restrictive packages.
Oracle Java SE is a fetch-restricted package, thus need a few extra steps to emerge. For instance, we should manually download the distfile at first. Try:
~ # emerge -pvt oracle-jdk-bin:1.7
Slot 1.7 means Java 7 while 1.8 refers to Java 8. Likely:
Go to the specified URL of ebuild, download jdk-7u80-linux-x64.tar.gz and put it under /usr/portage/distfiles.
# /etc/portage/package.license/oracle-jdk-bin # required by oracle-jdk-bin (argument) dev-java/oracle-jdk-bin:1.7 Oracle-BCLA-JavaSE
~ # emerge -av oracle-jdk-bin:1.7
nspluginUSE flag. Java plugin is now almost dead and vulnerable when browsing the Internet.
- A package java-config is installed alongside the JDK, which serves the same goal as Gentoo's eselect java-vm utility to choose JDK slots.
Using the java-config / eselect tool with root privileges, a system-wide default java virtual machine (VM) can be set. Of course, you can also use java-config / eselect to customize their personal VM on a user-by-user basis.
java-config --help java-config -L java-config [-S | -s] vm # -or- eselect java-vm help eselect java-vm list eselect java-vm show eselect java-vm set [ system | user] vm
JAVA_HOMEetc. environment variables is set automatically by /etc/profile.d/java-config-2.sh script from the ebuild.
- You can install the Oracle 8 alongside IcedTea 7.
Set system-vm to IcedTea 7 while set normal user-vm to Oracle 8. IcedTea 7 is stable and widely compatible while Oracle 8 assumes new Java features.
~ $ eselect java-vm list Available Java Virtual Machines:  icedtea-bin-7 system-vm  oracle-jdk-bin-1.8 user-vm ~ $ eselect java-vm set user 2 # eselect java-vm set system 1
Note: you cannot set user-vm under root account (root uses system-vm).
dev-java/icedtea-bin:8 throws SSL error when running gradlew:
Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: signature check failed
Currently, upgrading to dev-java/icedtea-bin-3.3.0-r1:8 fixes the issue.