Skip to content
Technology News Information & Jobs

Technology News Information & Jobs

Ubuntu Tutorials, Ubuntu How To , Linux Tips, Tech Jobs

  • Work with US
  • Search Jobs
  • Post a Job
  • Contact Us
  • Ubuntu
    • Ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 22.04
  • Themes
  • Linux
  • Laptops
  • Tutorials
  • Job Dashboard
  • Toggle search form
How To Set JAVA_HOME Environment Variable On Ubuntu 22.04

How To Set JAVA_HOME Environment Variable On Ubuntu 22.04

Posted on August 6, 2023August 7, 2023 By admin

How To Set JAVA_HOME Environment Variable On Ubuntu 22.04

Before setting Set JAVA_HOME Environment Variable On Ubuntu 22.04 LTS, make sure that you have Java installed in your Ubuntu 22.04 LTS. If there is no JAVA installed in your Ubuntu, then please check out the following link:

  • Install JAVA on Ubuntu 22.04 LTS

How To Set JAVA_HOME Environment Variable On Ubuntu 22.04

JAVA is one of the most popular programming languages. Many programs are written using Java programming language and the program written on JAVA uses the JAVA_HOME environment variable to determine the Java installation location.

It’s confusing but easy to set the JAVA_Home environment variable on Ubuntu 22.04 LTS.

At first, you need to determine where JAVA is installed. Run the following update-alternatives command to find the path of JAVA installation.

sudo update-alternatives --config java

You might see the output something like below:

Output

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-11-oracle/bin/java 1091 manual mode

Press  to keep the current choice[*], or type selection number:

From the above output, you can figure out the location of the JAVA and its associate.

OpenJDK 11 is located at /usr/lib/jvm/java-11-openjdk-amd64/bin/java and  Oracle Java is located at /usr/lib/jvm/java-11-oracle/jre/bin/java.

Now open /etc/environment using nano or your favorite text editor:

sudo nano /etc/environment

Go to the end of the file, and add the following line. Make sure that the path to the JAVA installation is correct

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

Save the file and exit the editor.

READ More Relevant Stuff:  How To Restart Ubuntu Server

Now you need to reload this file to apply the changes to your current session:

source /etc/environment

if you want to verify that the environment variable is set then run the following command:

echo $JAVA_HOME

You will see the output something like below:

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

In this way, you can easily set the JAVA_HOME Environment Variable On Ubuntu 22.04 LTS. This tutorial will help you set the JAVA_HOME Environment Variable when you have installed the multiple versions of Java on Ubuntu 22.04 LTS

 

Ubuntu 22.04 Tags:JAVA, ubuntu

Post navigation

Previous Post: Must Have Apps For Ubuntu 22.04 LTS
Next Post: How To Mount Windows Share On Ubuntu 22.04 LTS

Related Posts

The new default wallpaper that will ship in the upcoming Ubuntu 22.04 LTS release has been revealed. Ubuntu 22.04’s Default Wallpaper Ubuntu
How To Install Pantheon Desktop On Ubuntu 22.04 LTS And Derivatives How To Install Pantheon Desktop On Ubuntu 22.04 LTS And Derivatives Ubuntu 22.04
How To Install Nvidia Drivers On Ubuntu 22.04 LTS How To Correctly Install Uninstall Linux Ubuntu Nvidia Drivers Fast Ubuntu
How To Hide a File Or Folder In Ubuntu 22.04 LTS? How To Hide a File Or Folder In Ubuntu 22.04 LTS? Tutorials
How To Fix the “No Installation Candidate” Error in Ubuntu 22.04 LTS How To Fix the “No Installation Candidate” Error in Ubuntu 22.04 LTS Tutorials
How To Install Git On Ubuntu 22.04 LTS [2023] How To Install Git On Ubuntu 22.04 LTS [2023] Ubuntu 22.04

Recent Posts

  • New Job Search October 10, 2025
  • How To Enable Hibernate in Ubuntu 22.04 LTS May 20, 2024
  • Popular Ubuntu Games: Top 5 Games To Play March 17, 2024
  • WordPress | Your site doesn’t include support for the “generateblocks/container” block GenerateBlocks Plugin February 11, 2024
  • Ubuntu Autoremove Command Debian Autoremove Command February 10, 2024
  • How To Mount Windows 11 Shares on Debian Linux December 7, 2023
  • Anonymous Browsing 101: A Deep Dive Into Residential Proxies November 20, 2023
  • How To Correctly Install Uninstall Linux Ubuntu Nvidia Drivers Fast October 31, 2023
  • Ethical Web Design: The Dos and Don’ts October 28, 2023
  • Understanding the Role of Security Operations Center October 25, 2023
  • The Positive Effects of AI Tools and Online Services on Students Successful Essay-Writing Skills October 3, 2023

Categories

  • Android
  • Apple
  • Blogs
  • Debian
  • Fix
  • Gadgets
  • Game
  • Google
  • How To Ubuntu
  • Internet
  • Laptops
  • Linux
  • Linux Commands
  • Linux Game
  • Linux Mint
  • News
  • Operating Systems
  • Security
  • Technology
  • Themes
  • Tools
  • Tutorials
  • Ubuntu
  • ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 22.04
  • Windows 11
  • Wordpress
  • Search Jobs
  • Post a Job
  • Job Dashboard
  • Contact Us
  • About US
  • Cookie Policy
  • Terms and Conditions
  • Privacy Policy
  • Sitemap
  • Write For US

Tags

android apps centos ChatGPT command Commands Debian deepin Desktop docker Fedora fix game games Gaming gnome google kernel linux linux commands linux kernel Linux laptops Linux Mint Linux themes minecraft NVIDIA Python Raspberry Pi sysadmin themes ubuntu ubuntu 18.04 Ubuntu 18.04 LTS Ubuntu 20.04 ubuntu 20.04 lts Ubuntu 22.04 LTS Ubuntu games Ubuntu kernel ubuntu themes ubuntu tutorial VirtualBox Windows Windows 11 Wine WSL
itsubuntu.com is an Equal Opportunity Employer. For Advertisement, Jobs, Guest posts, and any other thoughts, email us at [email protected]
  • Automotive Service Writer – Markosian Auto Tooele

    • Tooele, UT
    • AutoMax Recruiting
    • Full Time
  • Copywriter/ Copy Editor at Identified Talent Solutions Phoenix, AZ

    • Phoenix, AZ
    • Identified Talent Solutions
    • Full Time
  • Automotive Front Counter/Service Writer

    • Bakersfield, CA
    • AppleOne
    • Full Time
  • Service Writer

    • West Columbia, SC
    • German Autowerks
    • Full Time
  • Service Writer

    • Jeannette, PA
    • Scott Electric Company
    • Full Time
  • ML Data Engineer #978695 (Seffner)

    • Seffner, FL (Remote)
    • Dexian
    • Part Time
  • Entry-Level Writer – Hybrid

    • South Jordan, UT
    • Russell Tobin
    • Full Time
  • Technical Documentation Specialist

    • Charlotte, NC
    • Innova Solutions
    • Full Time

Copyright © 2025 Technology News Information & Jobs.

Powered by PressBook Grid Blogs theme