Following are the simple steps for setting the JAVA (JDK) JAVA_HOME and PATH in Unix


Note: Considering the java have installed in /opt/jdk1.7.0_79 or you can download form http://oracle.com
A. To set the environment variables:
echo ‘export JAVA_HOME=/opt/jdk1.7.0_79′ > /etc/profile.d/jdk.sh
echo ‘export PATH=$JAVA_HOME/bin:$PATH’ >> /etc/profile.d/jdk.sh

B. What we need now to source the file we have created in above command /etc/profile.d/jdk.sh:
source /etc/profile.d/jdk.sh

C. Done for use, type as mention below in any Unix  terminal:

java -version
Output:
java version "1.7.0_79"
Java (TM) SE Runtime Environment (Build 1.7.0_79-b15)






1 comment:

  1. Good it more helpful..for setting java home and path in Linux/Unix.

    ReplyDelete

Please provide your input, it will honer for me...