Question

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();

Était-ce utile?

La solution

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.

Autres conseils

If you are launching a java applet you can pass them in a parameter called java_arguments.

If you are launching a JNLP program you can pass the parameters like this:

<resources>
    <jar href="MyApp.jar" />
    <java version="1.6+" initial-heap-size="5m" max-heap-size="256m" java-vm-args="-XXSomeOption" />
</resources>

You cannot change these parameters once the application is running, but you can re-launch java by looking at system properties like java.home to determine which JVM was used to launch your program.

The only way to set these values is to start another Java process. You can start a new process with the parameters you want and exit. You can't change the options once the process has started.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top