Answers for "hot to set java_home on ubun"

8

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

#Set JAVA_HOME Path
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
Posted by: Guest on September-07-2020
0

set java_home permanently ubuntu

sudo gedit /etc/profile
#add following lines

JAVA_HOME=/usr/lib/jvm/{your jdk path}
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
#logout to update the changes
Posted by: Guest on February-22-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language