6

I am trying to allocate 2 gigs of ram to a java application started from a bat file using this line of code:

 @echo off
    "%ProgramFiles(x86)%\Java\jre6\bin\java.exe" -Xmx2G -Xms1G -jar craftbukkit-1.2.5-R4.0.jar
    pause

When I attempt to run it like this, however, it spits out an error saying:

 Error occurred during initialization of VM
    Could not reserve enough space for object heap
    Could not create teh Java virtual machine
    Press any key to continue . . .

I currently have 8 gig of ram in my computer and I know I am using a max of 3 gigs at all times(I let the computer sit for the most part just running this server file). I have 2x4gig sticks of ram so I know its not separated out, and I know that I have enough free ram to allocate so why would it not let me? I am able to allocate 1536M(1.5 gigs) and under, but if I jump to 2G's it gives me this error. Any help is appreciated

Kazekage Gaara
  • 14,972
  • 14
  • 61
  • 108
Xander Luciano
  • 3,753
  • 7
  • 32
  • 53
  • 1
    What version of Windows? 32 bit versions only let you access approx. 3GB of RAM. Non server versions are also arbitrarily crippled as well, but not as much. –  Jun 18 '12 at 05:53
  • I am using 64 bit version of windows Edit: removing the min ram also did not work unknown – Xander Luciano Jun 18 '12 at 05:54
  • your question is already answered [here][1] [1]: http://stackoverflow.com/questions/171205/java-maximum-memory-on-windows-xp – NiranjanBhat Jun 18 '12 at 06:00

2 Answers2

6

You shall make sure that you are using 64 bit version of java - 32 bit version will be unable to allocate that much even on 64 bit windows

Konstantin Pribluda
  • 12,329
  • 1
  • 30
  • 35
  • I was apparently trying to start this with a 32 bit installation instead of 64 and therefore was limited. I just changed the java path to C:\Program Files\Java\jre7\bin\java.exe and it worked fine. thank you – Xander Luciano Jun 18 '12 at 06:04
  • As you may imagine, I already commited this mistake myself - so others do not have to ;) – Konstantin Pribluda Jun 18 '12 at 06:14
0

you just have to provide more space to the tomcat. for that you have to go to tomcat directory in it "bin" than go to setenv.bat file and then increase the size of "MaxPermSize=256m" 512m will be enough