I know The -D properties can be set by System.setProperty() which takes the key=>value form.
But how do I set the -XX options. I'm specifically looking to set -XX:+PrintGCDetails inside main();
You can't change that once the JVM has started. These are not Java system properties, but parameters that govern the startup and configuration of the JVM system.