标签:
1.从Oracle官网下载jdk
$ sudo mkdir /usr/lib/jvm
$ sudo mv jdk-8u5-linux-i586.tar.gz /usr/lib/jvm/
$ cd /usr/lib/jvm/
$ sudo tar -zxvf jdk-8u5-linux-i586.tar.gz
3、配置
$ sudo gedit /etc/environment
在environment中修改PATH,追加JDK路径,添加CLASSPATH与JAVA_HOME后如下:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/jdk1.8.0_05/bin"
CLASSPATH="/usr/lib/jvm/jdk1.8.0_05/lib"
JAVA_HOME="/usr/lib/jvm/jdk1.8.0_05"
然后就是要告诉系统,我们使用的sun的JDK,而非OpenJDK了:
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_05/bin/java 3004. 测试一下运行 java -version
如下所示则安装成功:
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) Server VM (build 25.5-b02, mixed mode)
标签:
原文地址:http://www.cnblogs.com/Longder/p/4845202.html