安装 Sun Java 6 时出现“HtmlConverter 不存在。”错误

安装 Sun Java 6 时出现“HtmlConverter 不存在。”错误

我是 Ubuntu 和 Java 新手。我该如何纠正这个问题?

freestyler@freestyler-HP-ProBook-4420s:~$ sudo apt-get install sun-java6-jdk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-2.6.35-22 linux-headers-2.6.35-22-generic
Use 'apt-get autoremove' to remove them.
Suggested packages:
  sun-java6-demo openjdk-6-doc sun-java6-source
The following NEW packages will be installed:
  sun-java6-jdk
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
Need to get 0B/19.7MB of archives.
After this operation, 61.2MB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously deselected package sun-java6-jdk.
(Reading database ... 194375 files and directories currently installed.)
Unpacking sun-java6-jdk (from .../sun-java6-jdk_6.21dlj-0ubuntu1~maverick1~ppa1_i386.deb) ...
sun-dlj-v1-1 license has already been accepted
Processing triggers for desktop-file-utils ...
Processing triggers for python-gmenu ...
Rebuilding /usr/share/applications/desktop.en_US.utf8.cache...
Processing triggers for doc-base ...
Processing 1 added doc-base file(s)...
Registering documents with scrollkeeper...
Processing triggers for python-support ...
Setting up sun-java6-jdk (6.21dlj-0ubuntu1~maverick1~ppa1) ...
update-alternatives: error: alternative path /usr/lib/jvm/java-6-sun/bin/HtmlConverter doesn't exist.
dpkg: error processing sun-java6-jdk (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 sun-java6-jdk
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

这不是最终答案,但我想正确格式化它。我在 Ubuntu 11.04 上使用 OpenJDK。使用以下命令安装效果很好apt

sudo apt-get install openjdk-6-jdk 
sudo apt-get install openjdk-6-source

首先,获取 JDK,然后安装 JDK 源(出于某种原因,它们未包含在 JDK 中)。这适用于 11.04 和 10.04 LTS... 也许您可以尝试一下 OpenJDK - 无论如何,它是未来。

答案2

不确定安装程序出了什么问题,但我一直手动安装 sun jvm。其实这并不难。

ubuntu 上的 jvm(或 jvms,您的系统上可能有多个,尤其是在升级后)最终位于 /usr/lib/jvm 中。通常实际的 jvm 位于 /usr/lib/jvm 文件夹中,您的 java 和 javac 可执行文件是来自类似 /usr/bin/java -> /etc/alternatives/java -> /usr/lib/java/somejdk.version.blah.blah.blah 的软链接。

所以:

  • 为您的硬件下载正确的 jvm,展开它并将其放在 /usr/lib/jvm 中(例如 /usr/lib/jvm/jdk1.6.026)

  • 软链接 /usr/lib/jvm/jdk -> /usr/lib/jvm/jdk1.6.026(这样,如果您以后想要交换 jvm,这是唯一需要更改的链接。

  • 指向你的操作系统用于 java 的链接(/usr/bin/java)->to /usr/lib/jvm/jdk/bin/java

  • 如果 JAVA_HOME 中存在任何环境变量,请确保它们指向 jdk 目录。

大多数情况下您只需要 java 和 javac,但 /etc/alternatives 中可能还链接有相当多的其他二进制文件,这些文件不常用(jhat、jmap 等),最好清理一下。

答案3

我使用最新的 sun jdk 在 ubuntu 中安装。我不知道上面的安装过程中哪里出了问题。如果您愿意,可以像我一样手动安装。我为此写了一篇博客,每当我忘记时我都会查阅。我想它可能会对你有所帮助。链接是:http://manoharbhattarai.wordpress.com/2010/03/23/install-java-manually-in-ubuntu-linux/

相关内容