0

I am using a centos virtual machine instance. I have edited the /root/.bash_profile and set the JAVA_HOME path.

the changes are saved but when I type echo $JAVA_HOME, the command executes but show nothing.

typing which java shows some other folder, which doesnt exist.

please help me out

user727272
  • 101
  • 1

2 Answers2

0

Command from .bash_profile will be applied where user log on, try to logoff and logon or restart computer.

Do you use SUN JDK or Open JDK ?

Khaled
  • 36,533
  • 8
  • 72
  • 99
tasmanian_devil
  • 204
  • 3
  • 9
0

You could also set JAVA_HOME by creating a shell script in /etc/profile.d/ directory, for example:

create file: /etc/profile.d/java.sh

with following contents:

JAVA_HOME=/usr/java/default
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH

Please note that directory should target place were java was installed. One above should be proper when you install Oracle JDK.

Following variables will be set during system start.

rsc
  • 101
  • 2