Just edit & append below code at the end of file (vi /etc/profile)
export JAVA_HOME=/home/priyan/softwares/jdk1.7.0_80
export PATH=$PATH:$JAVA_HOME/bin
echo $JAVA_HOME
/home/priyan/softwares/jdk1.7.0_80 - - - This is my location. You can add your own
export JAVA_HOME=/home/priyan/softwares/jdk1.7.0_80
export PATH=$PATH:$JAVA_HOME/bin
echo $JAVA_HOME
/home/priyan/softwares/jdk1.7.0_80 - - - This is my location. You can add your own