Linux

嘗試使用 update-java-alternatives 切換到 Java 6 後如何在 Ubuntu 中修復 Java

  • March 28, 2011

我嘗試使用“update-java-alternatives”命令從 Java 5 切換到 Java 6,如本頁所述:https ://help.ubuntu.com/community/Java

但是後來當我嘗試執行java時出現以下錯誤:

root@webserver:~# java
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

我還嘗試使用“apt-get”重新安裝 java 二進製文件,但我沒有成功重新安裝它。我想發布“apt-get”錯誤,但不幸的是我不知道如何用英語而不是德語列印錯誤消息。

我的系統是 Ubuntu 8.04 ROOT 伺服器。

這是再次安裝 Java 6 的(Google翻譯的)英文文本:

root@server:~# apt-get install sun-java6-jdk
Reading package lists ... Ready
Dependency tree
Reading state information ... Ready
sun-java6-jdk is already the newest version.
sun-java6-jdk set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 86 not upgraded.
1 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Set up a sun-java6-bin (6-03-0ubuntu2) ...
Could not create the Java virtual machine.
dpkg: error processing sun-java6-bin (- configure):
Subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
sun-java6-bin
E: Sub-process / usr / bin / dpkg returned an error code (1)

我希望這可以幫助你幫助我。

Java 說它沒有足夠的記憶體。您是否嘗試使用記憶體限制參數執行它,例如java -Xms64m -Xmx512m(將值調整為伺服器可用記憶體)?

我建議再次嘗試安裝,這樣:

apt-get --reinstall install sun-java6-jdk

這將完全重新安裝軟體,而不是嘗試配置已經存在的軟體。

引用自:https://serverfault.com/questions/147146