Shell/Bash: ubuntu change default java path Example


Shell/Bash Example: This is the "ubuntu change default java path" Example. compiled from many sources on the internet by

how to set java_home in ubuntu

#Update repo
sudo apt update

# Install java 8 from ubuntu repo
sudo apt install openjdk-8-jdk -y

ls /usr/lib/jvm/java-8-openjdk-amd64/
 export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
 echo $JAVA_HOME
 #Add JAVA bin directory to the PATH variable
 export PATH=$PATH:$JAVA_HOME/bin
 echo $PATH
 java -version

ubuntu change default java path

sudo update-alternatives --config java

* Summary: This "ubuntu change default java path" Shell/Bash Example is compiled from the internet. If you have any questions, please leave a comment. Thank you!