Linux上安装jdk
跳到导航
跳到搜索
针对不同发行版本下载相对应包
rpm -ivh jdk-8u121-linux-x64.rpm
下载通用二进制包解压安装
tar zxvf jdk-8u65-linux-x64.tar.gz $mv jdk1.8.0_65 jdk echo 'JAVA_HOME=/data/jdk/ CLASSPATH=.:$JAVA_HOME/lib.tools.jar PATH=$PATH:$JAVA_HOME/bin export JAVA_HOME PATH' >>/etc/profile #set java environment 建议用这个 JAVA_HOME=/usr/java/jdk1.7.0_79 JRE_HOME=/usr/java/jdk1.7.0_79/jre CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin export JAVA_HOME JRE_HOME CLASS_PATH PATH
configure
#set java environment 如果是rpm安装 JAVA_HOME=/usr/java/jdk1.8.0_121 JRE_HOME=/usr/java/jdk1.8.0_121/jre CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin export JAVA_HOME JRE_HOME CLASS_PATH PATH
参考
https://docs.oracle.com/cd/E19509-01/820-5483/inst_jdk_javahome_t/
http://wiki.jikexueyuan.com/project/linux-in-eye-of-java/JDK-Install.html