Linux – How to repair Java in Ubuntu after trying to switch to Java 6 using update-java-alternatives

aptjavalinuxUbuntu

I tried to switch from Java 5 to Java 6 using the "update-java-alternatives" command like explained on this page: https://help.ubuntu.com/community/Java

But afterwards I get the following error when I tried to execute 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.

I also tried to reinstall the java binaries using "apt-get" but I didn't succeed reinstalling it. I would like to post the "apt-get" errors, but unfortunately I don't know how to print out the error messages in English and not in German.

My system is a Ubuntu 8.04 ROOT server.

Here is the (Google translated) english text tring to install Java 6 again:

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)

I hope that this might help you helping me.

Best Answer

Java is saying that it doesn't have enough memory. Have you tried to run it with memory limiting parameters, like java -Xms64m -Xmx512m (adjust the values to your server available memory)?

Related Topic