Installing Java 8 on Linux

I hate to admit it but for some tasks on Linux are easier for some less technical people on other operating systems like windows. Simply run the executable which, most of the time, prompts for the install path and then proceeds to install to your hard disk.

Each version of Linux is a bit different so the the actual howto’s for installing software may differ slightly.  I wanted to create a small development so I took the new linux mint 18.1 version for a spin.  I rolled a virtual machine so I could do some testing.

The steps for installing the official Java is actually not much more complex than the following.

  • make sure your computer is up to date
  • uninstall existing open JDK Java
  • download official version of Java
  • unpack Java
  • copy or move to its installed location
  • make this version the default

I simply looked all of this up at the mint site.

https://community.linuxmint.com/tutorial/view/1372

My final step is no different than from the tutorial but you do need to do this for each program that you wish to use.  This is the small script that I used to set the both the java and javac program as default using this version.

sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk1.8.0_121/bin/java" 1
sudo update-alternatives --set java /opt/java/jdk1.8.0_121/bin/java

sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/java/jdk1.8.0_121/bin/javac" 1
sudo update-alternatives --set javac /opt/java/jdk1.8.0_121/bin/javac
This entry was posted in Command line, Setup From Scratch. Bookmark the permalink.