I am able to run a Java program through Eclipse by setting the VM arguments as -Xmx1024m -Xms256M. Now I want to run the same Java program (jar) through a .bat file in Windows. I am setting the JVM values in the file as follows
@echo off
set JAVA_OPTS="-Xmx1024m -Xms256m -XX:+HeapDumpOnOutOfMemoryError"
java -cp TA.jar com.myClass
But when I run the same program through batch (.bat in Windows XP) it throws Out of Memory error and I suspect that the JVM setting through the .bat file is not working.
It should be _JAVA_OPTIONS instead of JAVA_OPTS.
Use the arguments directly
java -Xmx1024m -Xms256m -XX:+HeapDumpOnOutOfMemoryError -cp TA.jar com.myClass
You don't need to set them at JAVA_OPTIONS
. To be sure that your application is using the parameters that you want:
jvisualvm
that comes with java. Just type "jvisualvm" at command line if you have set java correctly at your path.There should be set your jvm options.
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