ubuntu12.4安装java环境
1.下载jdk
jdk-6u45-linux-x64.bin
2.运行.bin文件
aping@ubuntu-T2:~/down$ sudo chmod +x jdk-6u45-linux-x64.bin
aping@ubuntu-T2:~/down$ sudo ./jdk-6u45-linux-x64.bin
3.移动到安程序目录
aping@ubuntu-T2:~/down$ sudo mkdir /home/app/java
aping@ubuntu-T2:~/down$ sudo mv jdk1.6.0_45 /home/app/java/
4.设置环境变量
aping@ubuntu-T2:~/down$ sudo vim /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/app/java/jdk1.6.0_45/bin/"
JAVA_HOME="/home/app/java/jdk1.6.0_45"
CLASSPATH="/home/app/java/jdk1.6.0_45/lib/"
aping@ubuntu-T2:~/down$ source /etc/environment #环境变量生效
aping@ubuntu-T2:~/down$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/app/java/jdk1.6.0_45/bin/
5.查看下java版本
aping@ubuntu-T2:~/down$ java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
(责任编辑:IT) |