问题
I'm trying to run Cassandra on my computer, but I keep getting the following error message:
Invalid initial heap size: -Xms4096M
The specified size exceeds the maximum representable size.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Anyone know why and how to fix this?
I am running:
Windows 10 Pro 64bit
Java 32 Bit
It seems I need to install a 64bit version of JRE. I have tried searching java.com and oracle.com for this, but I can't find anything obvious which will let me install a 64bit JRE. The default installer from java.com seems to be 32bit. Can someone please let me know how and where to get the 64bit JRE from?
回答1:
Since the JVM needs more space than just the heap like swap space and VM overhead, the maximum heapspace in a 32Bit JVM should be lower than 4GB.
- You can try out setting the maximum heapspace to 2GB with:
-Xmx2048M
- Alternatively you can just install a 64Bit JVM.
For more information, check out the Oracle FAQ for the HotSpot JVM
回答2:
Java 32 Bit
While the theoretical maximum heap size is indeed 4G for 32 bit, the actual max size is lower than this, as described here and here. Use 64 Bit JRE to avoid this.
来源:https://stackoverflow.com/questions/58421211/invalid-initial-heap-size-xms4096m