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

2 Answers 2

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.

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 ?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .