How to set JAVA_HOME for Java in Linux ?

  Sep 15, 2016

Can someone tell me the process of setting JAVA_HOME in Ubuntu machine.

Solved 0
linux ubuntu 1 year ago 1 Answer 0 views

Answers ( 1 )

  1. 1 year ago

    You can set your JAVAHOME in /etc/profile as Petronilla Escarabajo suggests. But the preferred location for JAVAHOME or any system variable is /etc/environment.

    Open /etc/environment in any text editor like nano or gedit and add the following

    JAVA_HOME="/usr/lib/jvm/open-jdk" (java path could be different)

    Use source to load the variables, by running this command:

    source /etc/environment

    Then check the variable, by running this command:

    echo $JAVA_HOME

Your Answer