I have a Java program that starts with a batch file with this line:
javaw -Xms64m -Xmx1024m com.acme.MyProgram
However, on some computers, the program does not start and displays the following message:
Failed to reserve enough space for the heap of objects. Failed to create Java virtual machine.
The problem is that the maximum size of the memory allocation pool is larger than the computer can handle. Reducing the maximum size of the memory allocation pool from 1024 m to 512 m seems to solve the problem.
Is there a way to determine how much memory is available on a computer before (from within a batch file) and determine whether to use it -Xmx1024mor -Xmx512min a batch file call? Please note that this batch file should only work on Windows.
source
share