Enabling JVM options with Java Web Start / JNLP

mikera picture mikera · Aug 16, 2010 · Viewed 11.9k times · Source

I'm creating a Web Start application which would benefit from some of the newer JVM options (especially escape analysis, G1 garbage collector etc.)

At the same time, I would like the application to work gracefully on older JVMs that do not support these options.

Is there a good way of achieving this?

Answer

David J. Liszewski picture David J. Liszewski · Oct 27, 2010

As Thorbjørn mentioned, Java 6 u10 allows multiple j2se elements in JNLP. The JNLP File Syntax resources section of the latest Java Web Start Developer's Guide, indicates that multiple j2se elements, each with java-vm-args attributes can be specified with the most preferred occurring first. For example:

<j2se version="1.3" initial-heap-size="64m" max-heap-size="128m"/>
<j2se version="1.4.2+" href="http://java.sun.com/products/autodl/j2se" 
      java-vm-args="-esa -Xnoclassgc"/>