Java: Install Java
Microsoft Windows and macOS
Download the Java JDK here: https://www.oracle.com/java/technologies/javase-downloads.html
(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
.
- Create a directory to put the java stuff there. e.g.
mkdir ~/apps
- Move the download tar file into the new directory. e.g.
mv ~/Downloads/jdk-8u25-linux-x64.tar.gz ~/apps
- Then cd to the directory.
cd ~/apps
- 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:
~/apps/jdk1.8.0_25/bin/java
~/apps/jdk1.8.0_25/bin/javac
~/apps/jdk1.8.0_25/bin/javadoc
Add Java's “bin” dir to your PATH
environment variable. For example, put this in your ~/.bashrc
:
# append java path to PATH PATH=$HOME/apps/jdk1.8.0_25/bin:$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)