Hi,
Have a problem getting the JAVA_OPTS env-parameter to work.
I am on a Windows XP system with JRE 1.6.0_12, and have written a test-class:
package info;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryUsage;
public class MemInfo {
public static void main(String[] args) {
MemoryUsage mu = ManagementFactory.getMemoryMXBean()
.getHeapMemoryUsage();
Long mIni = mu.getInit();
Long mMax = mu.getMax();
Long mUse = mu.getUsed();
System.err.println("ini=" + mIni);
System.err.println("max=" + mMax);
System.err.println("use=" + mUse);
System.err.println(mu.toString());
}
}
When I run it with:
java -Xms1g -Xmx1g info.MemInfo
I get the expected output (max heap size=1GB):
ini=1073741824
max=1065484288
use=1321224
init = 1073741824(1048576K) used = 1321224(1290K) committed = 1065484288(1040512K) max = 1065484288(1040512K)
But when I try to do the same, using JAVA_OPTS:
set JAVA_OPTS=-Xms1g -Xmx1g
java info.MemInfo
I get the default values output (max heap size=1GB) :
ini=0
max=66650112
use=206032
init = 0(0K) used = 206032(201K) committed = 5177344(5056K) max = 66650112(65088K)
Isnt JAVA_OPTS supposed to work like this?
Or what am I missing?
/rop