Readytocode
  • Home
  • Laravel
  • PHP
  • React Js
  • Git
  • Server
Facebook X (Twitter) Instagram
Readytocode
  • Home
  • Laravel
  • PHP
  • React Js
  • Git
  • Server
Facebook X (Twitter) Instagram Pinterest LinkedIn Reddit
Readytocode
You are at:Home How To Install Java on Ubuntu 20.04

Server

How To Install Java on Ubuntu 20.04

JustinBy JustinApril 28, 20221 Comment2 Mins Read
Facebook Twitter Pinterest LinkedIn Tumblr Email




Java-

Java and JVM both are required for running multiple software like Tomcat, Jetty, Glassfish and many more.

In this post i will install JRE and JDK using apt. You should know our Ubuntu 20.04 comes with Open JDK 11, which is an open-source variant of the JRE and JDK.

Install the JRE/JDK

please update the package index first

$ sudo apt update
$ sudo apt install default-jre

this open JRE will allow you to run almost all Java software.

$ java -version

You can check and verify this.

 

Now you think what about the JDK to compile and run java base software, To install JDK run the below command.

$ sudo apt install default-jdk

 

Set the JAVA_HOME Environment Variable

For setting up java_home environment , check the location where your java is installed. use below command to get.

$ sudo update-alternatives --config java

Output like below if you follow above steps

There are 1 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

 

Now run

$ sudo nano /etc/environment

 

at the end of file append the below code,

JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"

Note- this is your java path might be in your system this is different “/usr/lib/jvm/java-11-openjdk-amd64”. Copy this path carefully.

Save the file and exit the editor.

For applying the change in current session use below command

$ source /etc/environment

 

and now all done, check you java version

$ echo $JAVA_HOME

Output 

/usr/lib/jvm/java-11-openjdk-amd64

 

All Done.

Thanks , Happy coding.

 

 

 

Total
1
Shares
Share 0
Tweet 0
Pin it 1
Share 0

Like this:

Like Loading...

Related

Install Java on Ubuntu 20.04 Java Java Ubuntu20.04 Ubuntu20.04
Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Justin
  • Website

Related Posts

How to install Steam on Ubuntu 22.04 step by step

April 20, 2023

What is, How to Install & Use Kali Linux

April 1, 2023

ufw status inactive on Ubuntu 22.04

March 30, 2023

1 Comment

  1. Gal Jerman on December 8, 2022 4:10 am

    Top site ,.. amazaing post ! Just keep the work on !

    Reply

Leave A Reply Cancel Reply

Featured Posts
  • Why meta tag is important for seo 1
    How to change react Page title, Page Description and some other meta Tag
    • August 4, 2023
  • 2
    How to Generate image from text with Laravel 10
    • May 16, 2023
  • Laravel 10 Restrict User Access 3
    Laravel 10 Restrict User Access
    • May 3, 2023
  • Laravel 10 Pagination Example 4
    Laravel 10 Pagination Example
    • May 3, 2023
  • install Steam on Ubuntu 5
    How to install Steam on Ubuntu 22.04 step by step
    • April 20, 2023



Readytocode
Facebook X (Twitter) Instagram Pinterest
  • About Us
  • Privacy Policy
© 2025 ReadyToCode.

Type above and press Enter to search. Press Esc to cancel.

%d