2

I am trying to run mvn install in a project using jdk 1.4 which normally works. The jdk1.4 installation is 32-bit and my OS is windows 10 64-bit. But now I receive the following error:

[javac] Error occurred during initialization of VM
[javac] Could not create the Java virtual machine.
[javac] Could not reserve enough space for object heap

Naturally, I thought that some problem has occurred that has to do with low heap size (although it used to run with no problems with this application). The weird thing about my problem is that -Xmx1024M does not work for me but -Xmx800M works. It needs to run with lower memory rather than more memory. Does anyone know why such a problem could occur?

  • Please edit this into your question. There's an edit button for that. – Tschallacka Feb 13 '17 at 14:33
  • 1
    Well yes, the error says that the JVM could not find enough memory to run with your settings - it seems that the JVM could find 800MB of free space in memory, but not 1024MB. Not sure why you find it weird. – assylias Feb 13 '17 at 14:38
  • 1
    @assylias Since it's `-Xmx` rather than `-Xms`, it doesn't need to reserve the whole space at start, does it? And since it seems to be able to run under 800M, the answer is not that trivial. – RealSkeptic Feb 13 '17 at 14:40
  • The hardware utilizes 16GB of RAM. There is no way it cannot find 1024MB. And as I said **this used to work** . Maybe it is an issue with windows update. I am just asking if someone has seen it before to help me resolve it. – Efstathios Oikonomou Feb 13 '17 at 14:40
  • 32-bit versions of Windows are notorious finicky with how much memory exactly a _single_ process may use. Your program ask for more than Windows can give it. – Thorbjørn Ravn Andersen Feb 13 '17 at 14:42
  • 3
    JDK 1.4 is not supported under WIndows 10. Consider upgrading to a newer version of Java. – Thorbjørn Ravn Andersen Feb 13 '17 at 14:44
  • It's a 64-bit windows 10 installation. Maven runs with jdk1.8 and executes an antrun that compiles jdk1.4. – Efstathios Oikonomou Feb 13 '17 at 14:45
  • @StathisOikonomou The total amount of RAM is irrelevant here - when you run a 32 bit JVM you are limited to somewhere between 1GB and 1.8GB of RAM. Also: do you really need 1GB of RAM to run javac? – assylias Feb 13 '17 at 14:45
  • Possibly related: http://stackoverflow.com/a/16190055/829571 – assylias Feb 13 '17 at 14:46
  • @ThorbjørnRavnAndersen as I said it used to run. So compatibility shouldn't be an issue. – Efstathios Oikonomou Feb 13 '17 at 14:51
  • @StathisOikonomou not supported means that this **could** run but any update might break everything since this will not be tested. This version was replaced in 2004, so this is a bit outdated ;) – AxelH Feb 13 '17 at 14:53
  • @AxelH True. This is why I am asking this question and really just trying to find out if someone has encountered this before and found out what caused it so I can try to fix it. – Efstathios Oikonomou Feb 13 '17 at 14:55
  • Or change the ant script. You would be in trouble if the code was written using streams and you needed to compile it in 1.4. Change the ant setting to 1.8 and it should work with a newer JVM. Or read this http://stackoverflow.com/questions/11551678/how-to-change-ant-compiler-to-jdk-1-6 – efekctive Feb 13 '17 at 14:56
  • I really don't think you will find a lot of people running a J2SE 1.4 on a new system like Win 10. It would run on an XP probably (with the risk) or ni a VM at least. If it worked, track the changes from the last time it worked (code/OS update/hardware), this would at least reduce the possibilities – AxelH Feb 13 '17 at 14:56
  • java -version gives the following output: `C:\java\j2sdk1.4.2_19\bin>java -Xms512m -Xmx1024m -version Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine.` – Efstathios Oikonomou Feb 13 '17 at 15:28
  • @StathisOikonomou That something used to run but doesn't anymore is the precise characteristic of unmaintained software. – Thorbjørn Ravn Andersen Feb 14 '17 at 13:44

0 Answers0