[Linux]: To set JAVA/HADOOP env variables permenently
[root @ dbversity /tmp]# java -version
java version “1.8.0_05”
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
[root @ dbversity /tmp]
[root @ dbversity /tmp]# which java
/usr/java/jdk1.8.0_05/bin/java
Otherway to know the installed javapath
[root @ dbversity /tmp]# JAVAPATH=”$(readlink -f $(which java))”
[root @ dbversity /tmp]# echo “$JAVAPATH”
/usr/java/jdk1.8.0_05/bin/java
[root @ dbversity /tmp]
To set the variables permenently
[root @ dbversity /hadoop]# vi ~/.bashrc
# .bashrc
# User specific aliases and functions
alias rm=’rm -i’
alias cp=’cp -i’
alias mv=’mv -i’
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export JAVA_HOME=/usr/java/jdk1.8.0_05
export PATH=$PATH:$JAVA_HOME/bin:$PATH
export HADOOP_HOME=/hadoop
export PATH=$PATH:$HADOOP_HOME/bin:$PATH
~
~
“~/.bashrc” 27L, 583C written
[root @ dbversity /hadoop]#
[root @ dbversity /hadoop]#
[root @ dbversity /hadoop]# source ~/.bashrc
To cross check
[root @ dbversity /hadoop]# env | egrep “JAVA|HADOOP”
HADOOP_HOME=/hadoop
JAVA_HOME=/usr/java/jdk1.8.0_05
[root @ dbversity /hadoop]