Java: Install Java

By Xah Lee. Date: . Last updated: .

Microsoft Windows and macOS

Download the Java JDK here:

(JDK means Java Developer's Kit)

Installing Java on Ubuntu

If you are on Unbuntu Linux, for example download jdk-8u25-linux-x64.tar.gz.

  1. Create a directory to put the java stuff there. e.g. mkdir ~/apps
  2. Move the download tar file into the new directory. e.g. mv ~/Downloads/jdk-8u25-linux-x64.tar.gz ~/apps
  3. Then cd to the directory. cd ~/apps
  4. Unpack it by: tar xvfz jdk-8u25-linux-x64.tar.gz

After unpacking, the most important directory is the bin dir. For example, on my machine i have:

Add Java's “bin” dir to your PATH environment variable. For example, put this in your ~/.bashrc:

# append java path to PATH

Then, type . ~/.bashrc to reload the bash profile.

To test java, type java -version:

◆ java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)