Linux下安装并配置Oracle JDK


#去官网下载JDK

下面以”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

,

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注