有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

eclipse插件是否可以在JNLP文件中的j2se标记中指定java的多个版本?

我希望将RIA应用程序限制为java版本7和8

<resources os="Windows">
<j2se version="1.7*,1.8*" initial-heap-size="512m" max-heap-size="512m" />
</resources>

我正在尝试做类似上面的事情。我的目标是查看用户是否安装了Java7或Java8,并使用可用版本运行应用程序。如果用户有任何1.9及以上版本,则应用程序不应运行

这可能吗?如果可能,指定版本的正确语法是什么


共 (1) 个答案

  1. # 1 楼答案

    documentation开始:

    "The j2se/java element specifies what Java Platform Standard Edition Runtime Environment (JRE) versions an application is supported on, as well as standard parameters to the Java Virtual Machine. If several JREs are specified, this indicates a prioritized list of the supported JREs, with the most preferred version first."

    <java version="1.8" initial-heap-size="512m" max-heap-size="512m" href="http://java.sun.com/products/autodl/j2se"/>
    <java version="1.7" initial-heap-size="512m" max-heap-size="512m"/>
    

    另请注意,如果指定了href属性,则会请求特定于供应商的JRE(本例中为oracle)。如果您不希望出现这种情况或弹出安装例程(当没有安装相应的jre时),请删除href="http://java.sun.com/products/autodl/j2se"链接

    您也可以尝试从andrew处JaNeLa验证您的JNLP文件