# Installing Java JDK¶

Written by PChan on 2017-05-13

## Linux¶

Writing Java programs requires installing the Java JDK (Java Development Kit) while running Java programs would require you to install the Java JRE (Java Runtime). This guide would cover how to install the Java JDK.

• Ubuntu/Mint/Debian

sudo apt-get install openjdk-8-jdk openjdk-8-jre

• Fedora

su -c "yum install java-1.8.0-openjdk-devel java-1.8.0-openjdk"

• Other Distros, you probably know how...

Note

The current version of this guide assumes you want to install Java 8. To install a different version of Java, simply replace the 8 in openjdk-8-jdk and the 8 in openjdk-8-jre for Debian system with the latest version of Java.

For Fedora, replace the 8 in java-1.8.0-openjdk-devel and the 8 in java-1.8.0-openjdk with the latest version of Java.

## Mac OSX¶

Writing Java programs requires installing the Java JDK (Java Development Kit) while running Java programs would require you to install the Java JRE (Java Runtime). This guide would cover how to install the Java JDK.

We are going to be installing the Java JDK via Homebrew:

1. Install Homebrew following the Installing Homebrew guide if it is not already installed (near the bottom, you will also find instructions for installing cask and brew-cask-upgrade)

2. Install Java by executing the following command in the terminal:

$brew cask install java  Note: In the future, update Java with the following command: $ brew update
\$ brew cu


## Windows¶

Writing Java programs requires installing the Java JDK (Java Development Kit) while running Java programs would require you to install the Java JRE (Java Runtime). This guide would cover how to install the Java JDK.

The heading has been underlined in orange, while the download button for the JDK is circled in green.

Tip

To find out whether you are using x32 or x64 bit OS, check out this guide from Microsoft. To clarify, those with 32-bit operating system (as shown below) should download Oracle’s “Windows x86” Java. Those with 64-bit operating system should download Oracle’s “Windows x64” Java.

The operating system type is underlined in orange. Ignore the processor type.

• Using Windows Explorer, navigate to C:\Program Files\Java where you will find a directory for the Java JDK and a directory for Java JRE.
• C:\Program Files\Java\<jdk_directory>\bin (<jdk_directory> is the name of the jdk directory)
• C:\Program Files\Java\<jre_directory>\bin (<jre_directory> is the name of the jre directory)
3. Close any open Command Prompt windows. Open a new Command Prompt window by pressing the Windows key, then typing cmd enter. Try the following commands: javac -version and java -version