`apt-get install` 可以用于 JDK 吗?

Can `apt-get install` be used for JDK?(`apt-get install` 可以用于 JDK 吗?)

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

问题描述

我使用 linux 机器不到两周,所以我对 Linux 非常陌生.

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

我还想安装 Java Developers Kit.这应该怎么做?是否有 apt-get 命令,或者我应该直接点击 Sun 网站上的下载按钮?

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?

我确信有不止一种方法可以做到这一点,而且可能并不重要,但我对 apt-get install 在安装 PHP 和 MySQL 时的流畅性印象深刻,所以如果有一个正确的方法可以做到这一点,我想知道.

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.

我使用的是 Ubuntu 9.04 版

I'm using Ubuntu version 9.04

推荐答案

Oracle JDK 不再包含在 Ubuntu 存储库中.根据https://stackoverflow.com/a/15543636/192221,可以使用以下ppa:

The Oracle JDK is no longer included in the Ubuntu repos. According to https://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

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

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

update-alternatives --config java

默认使用 Oracle Java.

to use the Oracle Java by default.

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

本文标题为:`apt-get install` 可以用于 JDK 吗?

基础教程推荐