在Ubuntu下安装sun-java6-jdk需依次执行下列命令:(将maverick改为相应版本名,如10.04为lucid)
$
sudo
add-apt-repository
"deb http://archive.canonical.com/ maverick partner"
$
sudo
apt-get update
$
sudo
apt-get
install
sun-java6-jdk
或从http://www.oracle.com/technetwork/java/javase/downloads/index.html
下载bin文件,如jdk-6u24-linux-i586.bin
添加可执行权限
$ chmod a+x jdk-6u24-linux-i586.bin
解压
$ ./jdk-6u24-linux-i586.bin
复制到/usr/java中
$ cp -r ./jdk1.6.0_24 /usr/java
添加下列设置到/etc/profile或/etc/bash.bashrc或~/.bashrc中
export JAVA_HOME=/usr/java/jdk1.6.0_07
export PATH=${JAVA_HOME}/bin:${PATH}
测试
$ java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Server VM (build 19.1-b02, mixed mode)