Is there a way to set the max java heap size programmatically instead of as a vm argument?
Something like:
System.getProperties().put("<heap variable>", "1000m");
Under the Java tab, select JVM Options. Edit the -Xmx256m option. This option sets the JVM heap size. Set the -Xmx256m option to a higher value, such as Xmx1024m.
-Xmx to specify the maximum heap size.
If you look carefully you will space between -Xmx and 1800M, which is causing "Could not create the Java virtual machine: Invalid maximum heap size -Xmx". syntactically there should not be any space between -Xmx and heap size. Just remove the space between -Xmx and 1400M and it will work.
Not with any Hotspot JVM. The JVM heap parameters can only be specified on the command line, and are then fixed for the lifetime of the JVM.
With Hotspot Java implementations, the only way to "change" the heap size of an application is to relaunch it in a new JVM with different command line parameters.
(I vaguely recall that JVMs from some other vendors do allow some heap parameters to be changed in a running JVM. Perhaps someone can clarify.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With