Installing Java

Java can be annoying to keep straight, with its multiple overlapping components and inconsistent version numbering. Its components are

JRE - Java Runtime Environment. This is what allows you to execute java programs; it's included in nearly every modern OS. The JRE is essentially an implementation of the Java Virtual Machine (the special system that allows the same Java code to be executed across OS's). By itself, the JRE does not include the javac command and does not compile Java code.

JDK - Java Development Kit (or Java SDK, Software Development Kit). This is a special software package to help you develop Java code, including the ability to compile Java code from .java into .class files using the javac command. The JDK is not necessarily preinstalled on your OS. The JDK will always contain the JRE.

The JDK has three formats: Java SE (Java Platform, Standard Edition), Java EE (Enterprise Edition) and Java ME (Micro Edition). Java SE is the most popular, such that the labels Java SE, JDK, and Java SDK are all essentially equivalent.

The current version of the JDK is 1.8.0_91, also called JDK 8, 8 Update 91, or 8u91. The "1" at the beginning of the version number is typically ignored for some reason. The update number changes frequently.

There are two sources for the Java JRE/JDK. The first is Oracle Java, a partially proprietary version owned and distributed by Oracle. The second is OpenJDK, a fully open-source alternative. We recommend OpenJDK, and all directions here are for it.

You probably already have a JRE on your OS. You can check with the command

$ java -version

A non-empty result for this only means that you have the JRE, though. In order to develop the e-Lab, you'll need a full JDK. A quick way to find out if you have JDK installed is to try the javac command (say, $ man javac). If the command isn't found on a fresh installation, you probably don't have it.


Fedora 23

The OpenJDK JRE is pre-installed, though not the JDK itself:

$ java -version
openjdk version "1.8.0_92"
OpenJDK Runtime Environment (build 1.8.0_92-b14)
OpenJDK 64-Bit Server VM (build 25.92-b14, mixed mode)

(don't be confused by the references to "OpenJDK". This just means that OpenJDK's JRE is installed, it doesn't mean there's an actual JDK).

The package openjdk is the JRE, already installed. The actual JDK is given by the package openjdk-devel

Run $ dnf search openjdk-devel to see what's available. You should get a normal version and a debug version. Install the normal version

$ sudo dnf install java-1.8.0-openjdk-devel

replacing the version number with what's available to you.

Ubuntu 14/16

In Debian-derived repositories, the standard OpenJDK JDK is the package default-jdk. Otherwise, the process is congruent to Fedora:

$ sudo apt-get install default-jdk

-- Main.JoelG - 2016-06-16


Topic revision: r4 - 2016-07-23, JoelG
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback