#去官网下载JDK
- JRE http://java.com/zh_CN/download/manual.jsp
- JDK http://www.oracle.com/technetwork/java/javase/downloads/index.html
下面以”jdk-7u40-linux-x64.tar.gz”这个版本来进行说明:
#解压到目录“/usr/lib/jvm”
sudo mkdir -p /usr/lib/jvm
sudo tar zxf jdk-7u40-linux-x64.tar.gz -C /usr/lib/jvm
#安装Java
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_40/bin/java" 1 sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_40/bin/javac" 1 sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_40/bin/javaws" 1
#用update-alternatives –config命令激活刚才安装的Java
sudo update-alternatives --config java sudo update-alternatives --config javac sudo update-alternatives --config javaws
#为Firefox添加Java插件
mkdir ~/.mozilla/plugins
ln -sf /usr/lib/jvm/jdk1.7.0_40/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/
rm jdk-7u40-linux-x64.tar.gz