Ubuntu jdk8 installation

ubuntu jdk8 installation

Download JDK 1.8
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

tar zxvf jdk-8u121-linux-x64.tar.gz -C /usr/local /java/
cd /usr/local/java/

//Configure environment variables
vim /etc/profile
//Add the following:
#set java environment
export JAVA_HOME=/usr/local/java/jdk1.8.0_121
export JRE_HOME=${ JAVA_HOME}/jre
export CLASSPATH=.:$JRE_HOME/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=${JAVA_HOME}/bin:$PATH

echo $PATH //Check environment variables, /etc/profile needs to be restarted, if you don't want to restart, just execute


java -version//Check the version


to make the /etc/profile file take effect immediately after modification, you can use the following command:
# source /etc/profile

env // view all environment variables

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326826915&siteId=291194637