1。安装GDK
官网下载,或者用winscp工具下载后解压
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u73-b02/jdk-8u73-linux-i586.tar.gz
tar zxvf jdk-8u65-linux-x64.tar.gz
mv jdk1.8.0_65/ /usr/local/
vi /etc/profile.d/java.sh //加入如下配置
JAVA_HOME=/usr/local/jdk1.8.0_65
JAVA_BIN=/usr/local/jdk1.8.0_65/bin
JRE_HOME=/usr/local/jdk1.8.0_65/jre
PATH=$PATH:/usr/local/jdk1.8.0_65/bin:/usr/local/jdk1.8.0_65/jre/bin
CLASSPATH=/usr/local/jdk1.8.0_65/jre/lib:/usr/local/jdk1.8.0_65/lib:/usr/local/jdk1.8.0_65/jre/lib/charsets.jar
source /etc/profile.d/java.sh
如果以上配置成功,则下面的命令可以看到java的版本:
java -version
时间: 2024-12-26 02:25:36