Languages
[Edit]
EN

Ubuntu - set JAVA_HOME environment variable

7 points
Created by:
Sylvie-Justice
490

In this short article we would like to show how to set JAVA_HOME environment variable in Ubuntu.

 

Simple steps:

  1. check where Java JDK is installed
    Run command:

    Output: 

    so, Java JDK path is: /usr/lib/jvm/default-java
     
  2. add JAVA_HOME to /etc/environment
    Run command:
    Add following line over PATH:
    Update PATH line adding :$JAVA_HOME/bin at the end:
    Press ctrl+o and ctrl+x to save file and exit program.
    Screenshot:
    /etc/environment file with JAVA_HOME environment variable - Ubuntu
    /etc/environment file with JAVA_HOME environment variable - Ubuntu
  3. request to reload environment variables (optional operation)
    Run command:
    Note: it will reload currently used terminal variables only! So, run it for different terminals if it is necessary, re-login users or restart Linux.
     
  4. verify JAVA_HOME configuration
    Run command:
    Output:

     

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join