Minggu, 05 November 2017

How to Install JAVA 8 on Ubuntu

Java is the widely used programming language used by billion of application. Generally, every system required Java installed there. You may also need to Install Oracle Java 8 on your Linux system. You will require the PPA maintained by Webupd8 Team to Install Oracle JAVA 8 on Your Ubuntu and Linux System.

Read this => Install Java 8 on Debian
>Read this => Install Java 8 on CentOS, RHEL & Fedora
Use this tutorial to install Oracle JAVA 8 (JDK 8u144) on Ubuntu 17.10, 17.04, 16.04, 14.04 and 12.04 LTS and LinuxMint 18, 17 systems using PPA.

Step 1 – Install JAVA 8

First of all, you need to add webupd8team Java PPA repository in your system. After that install, Oracle Java 8 using following a set of commands.

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer

Step 2 – Verify Installed Java Version

After successfully installing Oracle Java using above step verify installed version using the following command.

rahul@tecadmin:~$ java -version 

java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

Step 3 – Setup Java Environment

Also, install Java configuration package. It seems like below package is already installed with latest operating systems during installation of JAVA packages. But you can still make sure by running below command.

$ sudo apt-get install oracle-java8-set-default

Now add the JAVA_HOME and JRE_HOME environment variable in /etc/environment configuration file using following command.

$ cat >> /etc/environment <<EOL
JAVA_HOME=/usr/lib/jvm/java-8-oracle
JRE_HOME=/usr/lib/jvm/java-8-oracle/jre
EOL

atau bisa menggunakan metode ini

$ sudo add-apt-repository ppa:openjdk-r/ppa

jika ada pesan error spt ini

Cannot add PPA: 'ppa:openjdk-r/ppa

maka jalankan perintah ini

$ sudo apt-get install --reinstall ca-certificates

lalu jalankan kembali 

$ sudo apt-get update

selanjutnya jalankan perintah ini

$ sudo apt-get install openjdk-8-jdk

lalu chek versi javanya

$ java -version 

openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~14.04-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)


 

ADD-APT-REPOSITORY: COMMAND NOT FOUND

The last time I encountered the add-apt-repository: command not found error I was using Ubuntu Server 12.4 Lucid. The solution then was to install python-software-properties as follows:

$ sudo apt-get install python-software-properties


This did not resolve the issue on my minimal virtual machine installation on Trusty so I installed apt-file – which is an apt package searching utility:

$ sudo apt-get install apt-file


Update apt-file:

$ apt-file update


Finally use apt-file to search for the add-apt-repository package:

$ apt-file search add-apt-repository


As you can see add-apt-repository is in software-properties-common:

software-properties-common: /usr/bin/add-apt-repository
software-properties-common: /usr/share/man/man1/add-apt-repository.1.gz


After installing software-properties-common I was able to use add-apt-repository without any further issue:

$ sudo apt-get install software-properties-common