ZNHOO Whatever you are, be a good one!


  1. ABCs
  2. IcedTea Open Java SE
  3. Oracle's Java SE
  4. Configuring
  5. Practice
  6. Bugs
  7. Refs


  1. 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.

  2. 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.

  3. 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.

  4. Java Distributions.

    IcedTea Open Java SE, Sun's Java 6 SE, Oracle's Java 7/8 SE, IBM Java SE, etc.

    1. Oracle's Java is previously called Sun Java (<= version 6) that was acquisited by Oracle, Inc.
    2. 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.
  5. 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.

  1. 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:

    These are the packages that would be merged, in reverse order:
    Calculating dependencies... done!
    [ebuild  N F   ] dev-java/oracle-jdk-bin-  USE="X alsa fontconfig (-aqua) -derby -doc -examples -jce -nsplugin -pax_kernel (-selinux) -source" 149,933 KiB
    [ebuild  N     ]  dev-java/java-config-2.2.0:2::gentoo  PYTHON_TARGETS="python2_7 python3_4 -python3_3" 51 KiB
    [ebuild  N     ]   dev-java/java-config-wrapper-0.16::gentoo  8 KiB
    [ebuild  N     ]   sys-apps/baselayout-java-0.1.0::gentoo  71 KiB
    [ebuild  N     ]  app-eselect/eselect-java-0.1.0::gentoo  71 KiB
    Total: 5 packages (5 new), Size of downloads: 150,132 KiB
    Fetch Restriction: 1 package (1 unsatisfied)
    Fetch instructions for dev-java/oracle-jdk-bin-
     * Oracle requires you to download the needed files manually after
     * accepting their license through a javascript capable web browser.
     * Download the following files:
     *   jdk-7u80-linux-x64.tar.gz
     * at 'http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html#jdk-7u80-oth-JPR'
     * and move them to '/usr/portage/distfiles'
     * If the above mentioned urls do not point to the correct version anymore,
     * please download the files from Oracle's java download archive:
     *    http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html#jdk-7u80-oth-JPR

    Go to the specified URL of ebuild, download jdk-7u80-linux-x64.tar.gz and put it under /usr/portage/distfiles.

  2. Accept the Oracle-BCLA-JavaSE license.

    # /etc/portage/package.license/oracle-jdk-bin
    # required by oracle-jdk-bin (argument)
    dev-java/oracle-jdk-bin:1.7 Oracle-BCLA-JavaSE
  3. Emerge

    ~ # emerge -av oracle-jdk-bin:1.7
  4. Notes

    Don't add nsplugin USE flag. Java plugin is now almost dead and vulnerable when browsing the Internet.


  1. 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.
  2. 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
  3. JAVA_HOME etc. environment variables is set automatically by /etc/profile.d/java-config-2.sh script from the ebuild.


  1. You can install the Oracle 8 alongside IcedTea 7.
  2. 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:
      [1]   icedtea-bin-7  system-vm
      [2]   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

Refer to redhat bug 1417317 and gentoo bug 605430.

Currently, upgrading to dev-java/icedtea-bin-3.3.0-r1:8 fixes the issue.


  1. gentoo wiki java
  2. gentoo java guide