使用Java Web Start/JNLP启用JVM选项
我正在创建一个Web Start应用程序,它将从一些较新的JVM选项(尤其是转义分析,G1垃圾收集器等)中受益.
I'm creating a Web Start application which would benefit from some of the newer JVM options (especially escape analysis, G1 garbage collector etc.)
同时,我希望该应用程序在不支持这些选项的旧版JVM上正常运行.
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?
如Thorbjørn所述,Java 6 u10允许JNLP中包含多个j2se
元素. JNLP文件语法 Java Web Start开发人员指南的/strong> resources
部分,指示可以指定多个j2se
元素,每个元素具有java-vm-args
属性,并且最优先出现的元素优先.例如:
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"/>