首页 > 代码库 > JAVA环境搭建
JAVA环境搭建
下载JDK的官方网址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
[root@localhost local]# mkdir -pv /usr/local/java #新建java根目录
[root@localhost local]# cd /usr/local/src
[root@master src]# wget http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-i586.tar.gz?AuthParam=1492996665_22aa4ec92bc85d04a6451ada2203534d
[root@localhost src]# tar -zxf jdk-8u131-linux-i586.tar.gz\?AuthParam\=1492996665_22aa4ec92bc85d04a6451ada2203534d
[root@localhost src]# mv jdk1.8.0_131 /usr/local/java/jdk1.8
[root@localhost java]# cd /usr/local/java/jdk1.8/ #验证是否成功
[root@localhost jdk1.8]# ls
vim /etc/profile #配置环境变量
export JAVA_HOME=/usr/local/java/jdk1.8
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$HOME/bin
[root@master ~]# source /etc/profile #重读配置文件,如果不行则重启
[root@localhost ~]# java -version #验证配置
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) Client VM (build 25.131-b11, mixed mode)
本文出自 “一万年太久,只争朝夕” 博客,请务必保留此出处http://zengwj1949.blog.51cto.com/10747365/1918742
JAVA环境搭建