Java is a programming language developed by engineers of Sun Microsystems. The language is object-oriented and designed to run on multiple platforms without the need of recompiling code for each platform. Although Java can be compiled as a native program, much of Java's popularity can be attributed to its portability, along with other features such as garbage collection. The ability to compile once and run in various platforms is achieved through the use of just-in-time compilers (JIT), which compile Java bytecodes into native code when a given program is run.
In order to run Java bytecodes, one needs to have a JRE (Java Runtime Environment) installed. A JRE provides core libraries, a platform dependent Java Virtual Machine, plug-ins for browsers, among other things. A JDK (Java Development Kit) adds programming tools, such as a bytecode compiler and a debugger.
Gentoo provides numerous JREs and JDKs. Among the current alternatives, we have:
The default is the Blackdown JRE/JDK pair, as it is freely ("free as in beer") available without any registration fuss.
Both the Sun JRE/JDK and the IBM JRE/JDK are generally faster, but getting them is a bit more work, as you are required to read and accept their license before downloading (IBM additionally requires you to register).
Our ebuilds for the Sun and IBM JRE/JDKs will notify you of where to go to download them.
If you run
You should download the indicated file(s) into
Gentoo has the ability to have multiple JDKs and JREs installed without them conflicting.
Using the
Running the command
# java-config --list-available-vms [blackdown-jdk-1.3.1] Blackdown JDK 1.3.1 (/etc/env.d/java/20blackdown-jdk-1.3.1) [blackdown-jre-1.3.1] Blackdown JRE 1.3.1 (/etc/env.d/java/20blackdown-jre-1.3.1) [ibm-jdk-1.3.0] IBM JDK 1.3.0 (/etc/env.d/java/20ibm-jdk-1.3.0) [ibm-jdk-1.3.1] IBM JDK 1.3.1 (/etc/env.d/java/20ibm-jdk-1.3.1) [ibm-jre-1.3.1] IBM JRE 1.3.1 (/etc/env.d/java/20ibm-jre-1.3.1) [sun-jdk-1.4.0] Sun JDK 1.4.0 (/etc/env.d/java/20sun-jdk-1.4.0)
The name in the brackets
# java-config --set-system-vm ibm-jdk-1.3.1 Now using IBM JDK 1.3.1 (/etc/env.d/java/20ibm-jdk-1.3.1)
Once you have issued
# env-update
After this, you will either want to relogin, or resource
As a regular user, you can use
For more information regarding USE flags, refer to the