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:
E: Sub-process / usr / bin / dpkg returned an error code (1)

I hope that this might help you helping me.

  • What is the output of java -version? – jneves Jun 16 '10 at 7:48
  • I just get this: java version "1.6.0_03" Java(TM) SE Runtime Environment (build 1.6.0_03-b05) Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode) – 2ndkauboy Jun 16 '10 at 10:30

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)?

  • Yes still the same error. I don't think that it is really a issue of memory as there is plenty of memory free. – 2ndkauboy Jun 13 '10 at 13:22
  • I would flip this around: increase these values and try again - like: java -Xms128m -Xmx768m – Mei Jun 20 '10 at 1:43

I would recommend trying the install again, this way:

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

This will reinstall the software completely, rather than trying to configure what is already there.

  • I tried you command, but I get almost the same error. It seems that the "sun-java6-bin" is causing the error. – 2ndkauboy Jun 2 '10 at 10:58
  • I would try the above command with the sun-java6-bin package as well. You might want to remove the packages and try again. I agree, too, with the other poster that Java is saying there isn't enough memory: perhaps Java itself is not reserving enough for its needs... – Mei Jun 20 '10 at 1:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.