我的 Java 安装已损坏

我的 Java 安装已损坏

I have recently upgraded to Ubuntu 11.10 and was noticing that Java was not working on a few websites and ran a check:

keith@KD-PB:~$ java -version

java version "1.5.0"

gij (GNU libgcj) version 4.6.1

Copyright (C) 2007 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

So I uninstalled my Java (OpenJDK 1.6.0 according to Ubuntu Software Centre) and reinstalled it and all the dependicies. So tried checking I had the right Java package installed;

keith@KD-PB:~$ sudo update-alternatives --config java

There is only one alternative in link group java: /usr/bin/gij-4.6

Nothing to configure.

So now I am scratching my head and not sure what is wrong. I have installed Oracle's JRE 6 and it works straight away, so what could be wrong with the OpenJDK?

Thanks

UPDATE - From some suggestions I inputted the following and think there is a problem with where /etc/alternatives/java is pointing;

keith@KD-PB:~$ ls -l which java lrwxrwxrwx 1 root root 22 2011-10-17 06:34 /usr/bin/java -> /etc/alternatives/java keith@KD-PB:~$ ls -l /etc/alternatives/java lrwxrwxrwx 1 root root 16 2011-10-17 06:34 /etc/alternatives/java -> /usr/bin/gij-4.6

keith@KD-PB:~$ dpkg -S /usr/lib/jvm/java-6-openjdk/jre/bin/java openjdk-6-jre-headless: /usr/lib/jvm/java-6-openjdk/jre/bin/java

答案1

Yeah... It's weird that the OpenJDK is not working... I had several problems with it and Eclipse, so I had to put Java from Oracle. It works excellent. My suggest: don't install OpenJDK.

答案2

I tried uninstalling and reinstalling the java installations several times but nothing changed, it would only detect the gij java application, or none at all when that was removed. So the following workaround did it for me.

I added the the Webupd8 PPA到我的 repo 列表,然后从中安装了名为“update-java”的应用程序。安装后,我从终端运行 update-java,它会查找我已安装的 java,找到后,在 GUI 中要求我选择将哪一个设置为标准。完成此操作后,我从终端运行 java-version 进行确认。

我可以确认它可以再次工作并且似乎设置正确。

相关内容