概述
Oracle Java (JVM/JDK)当前已经不再在Debian/Ubuntu软件源,Oracle已经停止JDL协议,只发布OpenJDK。当然,一旦你确实需要Oracle Java,可以从官网下载。
接下来是Ubuntu 安装Oracle Java JDK 7方法
当前,Oracle Java JDK 7 只发布开发者预览版。
1,下载Oracle JDK 7
选择接受协议,下载即可。
2,解压下载文件
解压时,会创建新文件夹”jdk1.7.0″。大家移动该文件夹到/usr/lib/jvm :
cd
sudo mkdir -p /usr/lib/jvm/ #just in case
sudo mv jdk1.7.0/ /usr/lib/jvm/
3,安装升级的的Java软件包(Ubuntu 10.04+):
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install update-java
一旦不想添加PPA,可以直接下载脚这篇文章件
4,打开终端,输入接下来命令安装Oracle Java JDK:
sudo update-java脚本会询问你选择哪个Java版本,大家选择“Jdk1.7.0”
稍等一会,Java安装完毕,可使用接下来命令查询java版本:
java -version
javac -version
安装Oracle Java 7 浏览器插件 与安装Oracle JDK 6。
Install Oracle Java 7 Browser plugin
Update: in my test, the Oracle Java 7 browser plugin crashes Firefox and doesn't load in Chrome and it seems I'm not the only one, so it would be a good idea noy to upgrade the browser plugin too (JDK 7 seems works ok). If you want to try it out anyway, see the installation instructions below. There are also instructions on reverting the changes at the end of the post.
Even though the steps below are for Firefox, the plugin will also be updated in Chrome (possibly other browsers too) as it looks under ~/.mozilla/plugins folder for plugins too.
Firstly, remove old Java plugin links using the commands below:
rm -f ~/.mozilla/plugins/libnpjp2.so ~/.mozilla/plugins/libjavaplugin_oji.so
sudo rm -f /usr/lib/firefox/plugins/libnpjp2.so /usr/lib/firefox/plugins/libjavaplugin_oji.so
And for the last step, let's create a simbolic link for the newly installed Java into the Mozilla plugins directory:
- 32bit:
ln -s /usr/lib/jvm/jdk1.7.0/lib/i386/libnpjp2.so ~/.mozilla/plugins/
- 64bit:
ln -s /usr/lib/jvm/jdk1.7.0/lib/amd64/libnpjp2.so ~/.mozilla/plugins/
Reverting the changes
Install Oracle JDK 6 from the Ubuntu repositories (make sure you enable the Partner repository under Ubuntu Software Center > Software Sources; alternatively, you can also use the LFFL Java PPA):
sudo apt-get install sun-java6-jdk sun-java6-plugin
Or, you can instal OpenDJK:
sudo apt-get install openjdk-6-jdk icedtea-plugin
Now run our script:
sudo update-java
And select the "java-6-sun-1.6.0.26" ("java-6-sun" works too) for Oracle JDK or the "java-1.6.0-openjdk" folder for OpenJDK.
For Oracle JDK, let's revert the browser plugin changes too:
rm -f ~/.mozilla/plugins/libnpjp2.so
32bit:
sudo ln -s /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/i386/libnpjp2.so ~/.mozilla/plugins/
64bit:
sudo ln -s /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/
最后
以上就是优雅大树为你收集整理的ubuntu oracle jdk7,Ubuntu安装Oracle Java 7(JDK)的方法及命令的全部内容,希望文章能够帮你解决ubuntu oracle jdk7,Ubuntu安装Oracle Java 7(JDK)的方法及命令所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复