$ sudo aptitude install sun-java6-jdk
[sudo] password for fal:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
No candidate version found for sun-java6-jdk
No candidate version found for sun-java6-jdk
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 41 not upgraded.
Need to get 0B of archives. After unpacking 0B will be used.
Writing extended state information... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
这是我的 /etc/apt/source.list:
deb http://archive.ubuntu.com/ubuntu/ jaunty main restricted universe
deb-src http://archive.ubuntu.com/ubuntu/ jaunty main restricted universe
deb http://archive.ubuntu.com/ubuntu/ jaunty-updates main restricted universe
deb-src http://archive.ubuntu.com/ubuntu/ jaunty-updates main restricted universe
deb http://security.ubuntu.com/ubuntu jaunty-security main restricted universe
deb-src http://security.ubuntu.com/ubuntu jaunty-security main restricted universe
deb http://us.archive.ubuntu.com/ubuntu dapper main restricted
deb http://us.archive.ubuntu.com/ubuntu dapper universe multiverse.
注意多元宇宙就在那里!为什么 Java 无法安装!?
答案1
将最后两行更改dapper
为,或者确保其中一行已启用。jaunty
multiverse
jaunty
答案2
或者你也可以使用其他 jvm,例如:
sudo aptitude install openjdk-6-jre
答案3
为什么不直接去 java.sun.com 下载呢?您将获得一个二进制包装的 shell 脚本。将其复制到您想要安装的位置,例如 /usr/local/ 和。(假设文件名为 jdk-sun-1.6.bin)
cd /usr/local/sh jdk-sun-1.6.bin
它会要求您接受许可证并将整个 jdk 解压到 jdk-sun-1.6 目录中。现在,将您的 $PATH 编辑为 /usr/local/jdk-sun-1.6/bin。如果您想转到较新或较旧的版本,您可以删除 jdk-sun-1.6 或在它旁边安装另一个 jdk 并更改路径。
我更喜欢直接从 Sun 网站安装 JDK,而不是使用 apt 实用程序。它包含在一个地方,您可以完全控制。