You can check if a Java Development Kit (JDK) is installed on your system by typing javac -version at the command line and seeing if you get a valid response. (The version numbers output by Java 8 software sometimes use the notation 1.8, for example 1.8.0_382.)

If you need to install a JDK, we recommend OpenJDK; select your operating system below and follow the instructions (as root, except for Homebrew on MacOS):

To install OpenJDK, run this Dnf command (as root):

dnf --assumeyes install java-1.8.0-openjdk-devel

To install OpenJDK, run this Pacman command (as root):

pacman -Sy --noconfirm jdk8-openjdk

To install OpenJDK, run this Dnf command (as root):

dnf --assumeyes install java-1.8.0-openjdk-devel

To install OpenJDK, run this Dnf command (as root):

dnf --assumeyes install java-1.8.0-openjdk-devel

To install OpenJDK, run this Yum command (as root):

yum --assumeyes install java-1.8.0-openjdk-devel

To install OpenJDK, run these Apt commands (as root):

apt update

apt install --assume-yes openjdk-8-jdk

To install OpenJDK, run this Dnf command (as root):

dnf --assumeyes install java-1.8.0-openjdk-devel

To install OpenJDK, run this Yum command (as root):

yum --assumeyes install java-1.8.0-openjdk-devel

To install OpenJDK, run this Dnf command (as root):

dnf --assumeyes install java-1.8.0-openjdk-devel

To install OpenJDK, run these Apt commands (as root):

apt update

apt install --assume-yes openjdk-8-jdk

To install OpenJDK, run this Homebrew command:

brew install openjdk@8

Note

You may be directed to create symlinks and/or update your PATH to make OpenJDK visible to your system, for instance:

For the system Java wrappers to find this JDK, symlink it with
  sudo ln -sfn /usr/local/opt/openjdk@8/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-8.jdk

openjdk@8 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have openjdk@8 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/openjdk@8/bin:$PATH"' >> ~/.zshrc

For compilers to find openjdk@8 you may need to set:
  export CPPFLAGS="-I/usr/local/opt/openjdk@8/include"

To install OPenJDK, run this MacPorts command (as root):

sudo port install openjdk

To install OpenJDK, run these Zypper commands (as root):

zypper refresh

zypper --non-interactive install java-1_8_0-openjdk-devel

To install OpenJDK, run these Zypper commands (as root):

zypper refresh

zypper --non-interactive install java-1_8_0-openjdk-devel

To install OpenJDK, run this Dnf command (as root):

dnf --assumeyes install java-1.8.0-openjdk-devel

To install OpenJDK, run this Yum command (as root):

yum --assumeyes install java-1.8.0-openjdk-devel

To install OpenJDK, run this Dnf command (as root):

dnf --assumeyes install java-1.8.0-openjdk-devel

To install OpenJDK, run this Yum command (as root):

yum --assumeyes install java-1.8.0-openjdk-devel

To install OpenJDK, run this Dnf command (as root):

dnf --assumeyes install java-1.8.0-openjdk-devel

To install OpenJDK, run this Yum command (as root):

yum --assumeyes install java-1.8.0-openjdk-devel

To install OpenJDK, run these Apt commands (as root):

apt update

apt install --assume-yes openjdk-8-jdk