linux change java

Java
sudo update-alternatives --config javasudo update-java-alternatives -s java-8-oracle
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/
export PATH=$PATH:$JAVA_HOME
123
Source

Also in Java: