我尝试使用“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 的英文文本(谷歌翻译):
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)
我希望这可以帮到你帮助我。
答案1
Java 提示内存不足。您是否尝试过使用内存限制参数来运行它,例如java -Xms64m -Xmx512m
(将值调整为服务器可用内存)?
答案2
我建议再次尝试安装,方法如下:
apt-get --reinstall install sun-java6-jdk
这将完全重新安装软件,而不是尝试配置已经存在的软件。