I run the following code from command line:
public class MemoryTest {
public static void main(String[] args) {
Runtime rt = Runtime.getRuntime();
long maxMb = rt.maxMemory()/(1024*1024);
System.out.println("Your JVM will use up to " + maxMb + " MB of memory for its heap");
}
}
It outputs: 247 MB
I then go to the Java icon in the Control Panel -> Java tab -> View -> Runtime Parameters column. I enter the following: -Xms512M -Xmx1024M
Then I run the memory test again. Output: 247 MB.
Why doesn't it increase?
If you are running java from the command line, you need to specify it on the command line
Try
java -mx1g MemoryTest