Debian安装JDK6

网上所说的:apt-get install sun-java6-jdk

执行完全不行,提示找不到这个包,估计是需要添加源吧!.

今天有个客户说让我帮忙安装Java6,没安过,没的说,直接百度,

结果千篇一律,全都是一样的安装文章,不知道有没有尝试过就安装,反正我是没安装成功.

还是Google好用:

Try this:

to install Java Development Kit(jdk)

# apt-get install sun-java6-jdk

or the Java runtime environment (jre):

# apt-get install sun-java6-jre

Source: https://wiki.debian.org/Java/Sun

Package is missing, has been obsoleted, or is only available from another source. However the following packages replace it: sun-java6-demo. I guess I’ll have to add squeeze back to my sources. –

源地址说:这个包已经丢失,或者废弃,可以用sun-java6-demo代替

还有一篇:

Run sudo apt-cache search java6 to get a list of packages available from the default repositories. If you don’t see anything you like, you will have to either add an apt repository or install java manually.

源地址说:运行apt-cache search java6获取匹配列表,如果看到你需要的,执行安装就可以了.

要的就是这个,因为上面那个解决方案是用的sun-java-demo,虽然我并不知道是干嘛的,但是有个demo单词,还是不装的好.

搜索Java6相关的包:

root@MyServer:~# apt-cache search java6
default-jdk - Standard Java or Java compatible Development Kit
default-jre-headless - Standard Java or Java compatible Runtime (headless)
default-jre - Standard Java or Java compatible Runtime
openjdk-6-jdk - OpenJDK Development Kit (JDK)
openjdk-6-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-6-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
root@MyServer:~#

安装:

root@MyServer:~# apt-get install openjdk-6-jdk

完成:

root@MyServer:~# java -version
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1~deb6u1)
OpenJDK Client VM (build 20.0-b12, mixed mode, sharing)

 

2 Replies to “Debian安装JDK6”

发表回复

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

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据