java 在 ubuntu 14.04 中安装 JDK8
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25549492/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
install JDK8 in ubuntu 14.04
提问by Senior Knight
I want to start programming in java and i am using ubuntu 14.04, i downlaoaed
我想开始用 java 编程,我使用的是 ubuntu 14.04,我下载了
jdk-8u20-linux-x64.tar.gz
jdk-8u20-linux-x64.tar.gz
and in oracle website there is a command to install it, it is the command
在oracle网站上有一个安装它的命令,它是命令
% tar zxvf jdk-8uversion-linux-x64.tar.gz
% tar zxvf jdk-8uversion-linux-x64.tar.gz
in terminal i got this
在终端我得到了这个
bash: fg: %: no such job
bash: fg: %: 没有这样的工作
anyone help me to intall the JDK.
任何人都可以帮助我安装JDK。
回答by Elliott Frisch
Add the webupd8ppa, and install from that -
添加webupd8ppa,并从中安装 -
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
Then
然后
java -version
should show you using Oracle Java 8. If not, or if you want to use a different version - run update-java-alternatives
with something like,
应该向您展示使用 Oracle Java 8。如果没有,或者如果您想使用不同的版本 - 运行update-java-alternatives
类似的东西,
sudo update-java-alternatives -s java-8-oracle
or
或者
sudo update-java-alternatives -s java-7-oracle
As appropriate.
作为适当的。
回答by mariusm
Debian way (whereas Ubuntu is Debian-baseD) of doing it is through packages. So it is highly preferred to make a deb package. Here is how:
Debian 的方式(而 Ubuntu 是基于 Debian 的)是通过包来实现的。所以最好制作一个 deb 包。方法如下:
sudo apt-get install java-package
make-jpkg jdk-8u20-linux-x64.tar.gz
sudo dpkg -i oracle-java8-jdk_8u20_amd64.deb
Maybe there is already some PPA already doing it for you, but better trust no-one and do it for yourself ;-)
也许已经有一些 PPA 已经在为你做这件事了,但最好不要相信任何人并为你自己做 ;-)