How to set JAVA_HOME environment variable for root user on AIX?

If you are following my previous post about installing Java 6 64bit on AIX 6.1 platform, next you have to set JAVA_HOME and PATH variables. If you want to set environment variables for non root users. You can set those variables in /home/<user>/.profile file.
For a root user, setting an environment variable is different. As you will not find it’s directory in /home.

There is a way for that. You can set envoirnment variable in /etc/profile. This will override all those envoirnment variables mentioned in .profile.

Setting variables in /etc/profile

For setting JAVA_HOME in /etc/profile enter following statements:

export JAVA_HOME

export PATH

You have to login again to see the changes. I am using putty, so will re-open it and login with root user.

Verifying variables

To verify your changes you can echo JAVA_HOME and PATH variables.

# echo $JAVA_HOME

# echo $PATH

# which java

I am using Korn Shell. To know which shell you are using, you can echo SHELL.

# echo $SHELL

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *