Xmx ignored when used in Runtime.exec

The Xmx and Xms is ignored in this code:

Runtime.getRuntime().exec(new String[]{"java", "-jar", "-Xms1024m", "-Xmx1200m", "\"data.jar\""});

or

Runtime.getRuntime().exec("java -jar -Xms1024m -Xmx1200m \"data.jar\"");

I get out of memory error.

But when I run the very same code from a batch file, it works fine:

java -jar -Xms1024m -Xmx1200m "data.jar"

Am I forgetting something? Why is the exec ignoring the Xmx and Xms arguments?