How to install oracle java JDK |Ubuntu 18.04.4 LTS

Dhanuka lakshan
2 min readMar 17, 2020

--

Hi buddy…I’m Dhanuka. who is currently studying @Institute_of_Java And Software Engineering. I am going to teach how to install java 8 in ubuntu operating system using terminal.So following the my instructions…First open the terminal press the keyboard shortcut(Alt+Ctrl+T)

1 Step :

sudo apt-get update

Then type the sudo password.You can see App stream cache update completed.

2 Step :

sudo add-apt-repository ppa:webupd8team/java

3 Step :

sudo apt-get update

4 Step :

sudo apt-get install oracle-java8-installer

5 step:

sudo update-alternatives --config java

you can change the jdk java version like you..if you want to change priority number you can type the Selection Priority number.

There are 2 choices for the alternative java (providing /usr/bin/java).Selection    Path                                            Priority   Status
------------------------------------------------------------
0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode
* 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
Press <enter> to keep the current choice[*], or type selection number:

That is all right.Now installed java-8-openjdk your operating system…

if you want to your java version you can type this.

java -version

Attention please. if your installed java version 1.8.0_242 your java compiler should be javac 1.8.0_242 .If this is not the case you must following below the instruction.(How to change default Java/Javac version on Ubuntu 18.04.4 LTS)

javac -version

After enter the password type below command.

sudo update-alternatives --config javac

then you can see below the result.

There are 2 choices for the alternative javac (providing /usr/bin/javac).Selection    Path                                          Priority   Status
------------------------------------------------------------
0 /usr/lib/jvm/java-11-openjdk-amd64/bin/javac 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/javac 1111 manual mode
* 2 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 manual mode
Press <enter> to keep the current choice[*], or type selection number:

--

--

Dhanuka lakshan
Dhanuka lakshan

Written by Dhanuka lakshan

I’m a Software engineering student who is currently studying @Institute_of_Java And Software Engineering(IJSE), I like coding and learn about new tech.

No responses yet