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:  How To Fix “Sub-process /usr/bin/dpkg returned an error code (1)” Error In Ubuntu

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

Fix the Laptop Brightness Problem In Ubuntu 22.04 LTS If you are having a problem with the brightness of your Laptop after installing Ubuntu 22.04 LTS then you are in the right place as we have a solution for it. There are multiple ways to fix the brightness problem in Ubuntu 22.04 LTS. How To Fix Brightness Problem In Ubuntu 22.04 LTS There are multiple ways to fix the brightness problem in Ubuntu 22.04 LTS. Method 1: In this very first method, we will take the help of software or app called "Brightness Controller". Run the following command to add PPA and install the Brightness Controller in Ubuntu 22.04 LTS. sudo add-apt-repository ppa:apandada1/brightness-controller sudo apt update sudo apt install brightness-controller Method 2: In this method, we will edit the Grub file to configure the setting and fix the brightness problem in Ubuntu 22.04 LTS. You need to open the file /etc/default/grub using gedit or any favorite editor of yours. sudo gedit /etc/default/grub After the file is open on editor, find the below line. GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" Change the above line to: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor" You might be wondering about the changes made by this update. These changes will load device-specific drivers in Linux. Save the file and close the text editor and run the following command to update the grub and restart your Ubuntu. after reboot, try adjusting the brightness using Laptop's dedicated control keys. update-grub Method 3: In this method, run the following command to find out the name of your display using the below command. xrandr | grep " connected" | cut -f1 -d " " So, the next is to change the brightness using the display name. xrandr --output system-display-name --brightness 0.7 Fix Brightness Problem In Ubuntu 22.04 LTS Ubuntu 22.04
Ubuntu Autoremove Ubuntu Autoremove Command Debian Autoremove Command Debian
Make Ubuntu Terminal Look Like Kali Linux [2023] Make Ubuntu Terminal Look Like Kali Linux [2023] Ubuntu 22.04
How to Fix “Username is not in the sudoers file. This incident will be reported” in Ubuntu How to Fix “Username is not in the sudoers file. This incident will be reported” in Ubuntu Tutorials
Ubuntu 23.04 Official Flavors Released How To Enable Hibernate in Ubuntu 22.04 LTS How To Ubuntu
How To Install Remmina On Ubuntu 22.04 LTS Jammy JellyFish How To Install Remmina On Ubuntu 22.04 LTS Jammy JellyFish How To Ubuntu

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]
  • Sr. Demand Writer (Costa Mesa)

    • Costa Mesa, CA
    • The Law Offices of Daniel Kim
    • Part Time
  • Technical Writer

    • Swiftwater, PA
    • Adecco
    • Full Time
  • Video Photojournalist

    • Washington DC
    • NTD
    • Full Time
  • Senior Technical Writer

    • Swiftwater, PA
    • Aequor
    • Full Time
  • Technical Writer II (Swiftwater)

    • Swiftwater, PA
    • HireTalent - Staffing & Recruiting Firm
    • Part Time
  • Service Writer

    • Richfield, OH
    • W.W. Williams
    • Full Time
  • Senior Data Scientist, Product, Google Play

    • Mountain View, CA (Remote)
    • Google
    • Full Time
  • Technical Writer

    • Pittsburgh, PA
    • The HIRD
    • Full Time

Copyright © 2025 Technology News Information & Jobs.

Powered by PressBook Grid Blogs theme