To install JAVA, follow the steps given below:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
Setting Java home variable for Spectrum Spatial Analyst
Set the below commands from the terminal window /etc/bash.bashrc
JAVA_ROOT=/usr/lib/jvm/java-8-oracle
export JAVA_ROOT
JAVA_HOME=$JAVA_ROOT
export JAVA_HOME
# PATH must be set to point to the JDK area
PATH=$JAVA_ROOT/bin:$PATH
export PATH
update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-8-oracle/bin/java 100
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-8-oracle/bin/javac 100
and run the following command from the same terminal-
source /etc/bash.bashrc