ubuntu10.10中没有JDK的源,所以在命令行下直接apt-get会提示找不到源,在sources.list中加入如下的源即可:
deb http://archive.canonical.com/ lucid partner
然后要
sudo apt-get update
更新完之后就可以直接安装了
sudo apt-get install sun-java6-jdk
sudo apt-get install sun-java6-jre
或者上网下载jdk的压缩包,解压之后修改环境变量即可。
sudo gedit /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/hcx/Java/jdk1.7.0_03/bin"
JAVA_HOME="/home/hcx/Java/jdk1.7.0_03"
JRE_HOME="/home/hcx/Java/jdk1.7.0_03/jre"
CLASSPATH=".:/home/hcx/Java/jdk1.7.0_03/bin/lib"