Hello mate! Today, I'd like to write about installing the latest version of Oracle Java, that's Oracle Java 8. Installing Oracle Java 8 on Ubuntu is as simple as installing another applications. It's because there is a PPA which provides an installer script. It downloads and installs the Oracle Java 8 automatically, make Oracle Java 8 as default Java on Ubuntu, and uninstaller in case you want to remove Oracle Java 8 from your system.
Well, simply run the following command to install Oracle Java 8 on Ubuntu:
Please wait for a while because it needs to download Oracle Java 8 from the official website.
- sudo add-apt-repository ppa:webupd8team/java
- sudo apt-get update
- sudo apt-get install oracle-java8-installer
Once installed, please make sure that Oracle Java 8 works properly and made default by the installer. Run "java -version" on Terminal.
If you see the output like the picture above, it means Oracle Java 8 is installed correctly.
Changing default Java
If you have two or more Java on your system, you can switch the default Java by running the following command:
- sudo update-alternatives --config java
Now, please type the corresponding number of Java you want to use. In this example, I want to switch to OpenJDK as default Java, so I type "1" and then press "Enter".
So, when I type "java -version" on Terminal, it displays the version of OpenJDK instead of Oracle JDK 8.
Enjoy :)
via: WebUpd8