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 1 Comment on How To Set JAVA_HOME Environment Variable On Ubuntu 22.04

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:  Things To Do After Installing Ubuntu 22.04 LTS

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

How To Reload /etc/network/interfaces in Ubuntu 22.04? How To Reload /etc/network/interfaces in Ubuntu 22.04? How To Ubuntu
Install PHP Mcrypt Extension On Ubuntu 22.04/Debian [Updated] Install PHP Mcrypt Extension On Ubuntu 22.04/Debian [Updated] How To Ubuntu
How To Install Git On Ubuntu 22.04 LTS [2023] How To Install Git On Ubuntu 22.04 LTS [2023] Ubuntu 22.04
How To Install OpenRGB On Ubuntu 22.04 | 20.04 LTS How To Install OpenRGB On Ubuntu 22.04 | 20.04 LTS In 2023 How To Ubuntu
How To Install Proprietary Drivers In Ubuntu 22.04 LTS How To Install Proprietary Drivers In Ubuntu 22.04 LTS Ubuntu 22.04
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

Comment (1) on “How To Set JAVA_HOME Environment Variable On Ubuntu 22.04”

  1. John says:
    November 1, 2022 at 12:42 pm

    here is what I get :*

    Exception in thread “main” java.lang.NoClassDefFoundError: javafx/application/Application
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
    at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
    at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    at com.xiaomitool.miunlock.Main.main(SourceFile:46)
    Caused by: java.lang.ClassNotFoundException: javafx.application.Application
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    … 10 more

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • 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
  • Linux Wget Examples September 27, 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]
  • Writer/Journalist Internship

    • Wakefield, MA
    • The Borgen Project
    • Internship
  • Business Analyst/Technical Writer

    • New York, NY
    • Lime Trading
    • Full Time
  • Science and Communications Writer/Editor

    • Boston, MA
    • Dana-Farber Cancer Institute
    • Full Time
  • Business Analyst-Technical Writer

    • Dallas, TX
    • Intellisoft Technologies
    • Full Time
  • Procedure Writer

    • Atlanta, GA
    • Synergis
    • Full Time
  • Technical Writer

    • Santa Clara, CA
    • Net2Source Inc.
    • Full Time
  • Senior Data Scientist, Core Product

    • Palo Alto, CA (Remote)
    • Data Masked
    • Full Time
  • Architectural Specifications Writer

    • Oakland, CA
    • Venture Personnel
    • Full Time

Copyright © 2025 Technology News Information & Jobs.

Powered by PressBook Grid Blogs theme