Set Up Your Java Home Path in Ubuntu

This short article will explain how to set your JAVA_HOME Environment path in your /etc/bash.basrc profile. Many Applications today look for the JAVA_HOME path, in order to function correctly.

Steps

  1. Launch the Terminal and sudo su to root.
  2. Identify where is Java installed on your Ubuntu Machine by typing

    which java.
  3. Now to set the JAVA_HOME globally, we edit the bash.bashrc file.
  4. At the end of the file type the following, one line at a time.
  5. Line 1. JAVA_HOME=/usr/lib/jvm/default-java/bin .
  6. Line 2. export JAVA_HOME
  7. Line 3. PATH=$PATH:$JAVA_HOME
  8. Line 4. export PATH
    .
  9. Close the Terminal and re-open it and issue the command

    echo $JAVA_HOME

    . You should get the new path.
  10. Type java -version , to see the version of Java installed.

Warnings

  • Do not type the path of the

    which java

    command
  • Instead , type this

    JAVA_HOME=/usr/lib/jvm/default-java

Related Articles