liunx安装JDK

作者:邓聪聪

1.到jdk官网上下载你想要的jdk版本

[root@test_server local]# ll
total 155576
drwxr-xr-x.   2 root root        45 Mar 19 10:34 bin
drwxr-xr-x.   3 root root        53 Mar 19 10:34 conf
drwxr-xr-x.   3 root root        90 Mar 21 13:15 etc
drwxr-xr-x.   3 root root        25 Jun  6 16:02 java
-rw-r--r--.   1 root root 159019376 Jun  6 11:58 jdk-8u11-linux-x64.tar.gz
drwxr-xr-x.   2 root root        27 Mar 19 10:34 sbin
drwxr-xr-x.   5 root root        40 Mar  8 16:16 sersync
drwxr-xr-x. 134 root bin       8192 Aug  8  2016 webmin
-rw-r--r--.   1 root root    270871 Jan 16 14:22 zabbix_agents_3.2.0.linux2_6.amd64.tar.gz

2.解压文件到指定目录下

tar -xf jdk-8u11-linux-x64.tar.gz -C java/

3.配置jdk的全局环境变量

方式1:
JAVA_HOME=/usr/local/java/jdk1.8.0_11
JRE_HOME=${JAVA_HOME}/jre
CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME CLASSPATH JRE_HOME
----------------------------------------------------------------------
方式2:
export JAVA_HOME=/usr/local/java/jdk1.8.0_11 
export JRE_HOME=${JAVA_HOME}/jre  
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib  
export  PATH=${JAVA_HOME}/bin:$PATH
----------------------------------------------------------------------

引用配置
[root@test_server local]#. /etc/profile

4.验证安装的jdk

java -version

 

posted @ 2019-06-01 23:03  邓聪聪  阅读(156)  评论(0编辑  收藏  举报