本文介绍了可以将“apt-get install”用于JDK吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用linux机器不到两个星期,所以我对Linux非常新鲜。



我也想安装Java Developers Kit。该怎么做?有没有一个 apt-get 命令,还是只需点击Sun网站上的下载按钮?



我确定有不止一种方法可以做到这一点,这可能并不重要,但是对于安装PHP时,如何平稳地 apt-get install 正确的方式来做到这一点,我想知道。



我使用的是Ubuntu 9.04版

解决方案

Oracle JDK不再包含在Ubuntu备份中。根据,可以使用以下ppa:

  echodeb http://ppa.launchpad.net/webupd8team/java/ubuntu精准主 tee -a /etc/apt/sources.list 
echodeb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precision main| tee -a /etc/apt/sources.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get install oracle-java7-installer

如果您已经安装了OpenJDK,则可能需要使用

  update-alternatives --config java 

默认使用Oracle Java。


I've been using a linux machine for less than two weeks, so I am extremely new to Linux.

I'd also like to install the Java Developers Kit. How should this be done? Is there an apt-get command, or should I just click on the download button at Sun's website?

I'm sure there is more than one way to do this, and it probably doesn't matter much, but I was impressed with how smoothly apt-get install worked when installing PHP and MySQL, so if there is a right way to do this, I'd like to know.

I'm using Ubuntu version 9.04

解决方案

The Oracle JDK is no longer included in the Ubuntu repos. According to http://stackoverflow.com/a/15543636/192221 , the following ppa can be used:

echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get install oracle-java7-installer

If you have OpenJDK installed already, you might need to use

update-alternatives --config java

to use the Oracle Java by default.

这篇关于可以将“apt-get install”用于JDK吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 17:11