Search code examples
javashellexportclouderajava-home

$JAVA_HOME variable changes with each new terminal


I recently installed Jdk1.8 on my machine. Everything went well and I made it work. After that I edited my /etc/profile file in order to set the new Java path. I edited the following line:

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk.x86_64

and then I executed

source /etc/profile

Here again everything went fine and I could see the changes on the terminal.

Problem is:

Everytime I open a new terminal I need to do

source /etc/profile

or else JAVA_HOME would have its old value.

Solution please? Thank you


Solution

  • If your username is 'test', then create a file called /home/test/.profile if it does not exist, and add your export command there.