如何在 jnlp 文件中区分 32 位和 64 位 java 版本 [英] How to distinguish 32 bit from 64 bit java version in jnlp files
问题描述
为了启动我们的遗留应用程序,我们通过 jnlp 使用 java WebStart.
To start our legacy application, we use java WebStart via a jnlp.
我们希望支持 64 位 Java 客户端,但我们的库之一是依赖于架构的.
We would like to support 64-bit Java clients but one of our libraries is architecture dependent.
我们想过做这样的事情:
We thought of doing something like:
<resources>
<j2se version="1.6+" sun.arch.data.model="64"/>
<jar href="/apps/swt-3.7M5-win32-win32-x86_64_s.jar" download="eager" />
</resources>
<resources>
<j2se version="1.6+" />
<jar href="/apps/swt-3.7M5-win32-win32-x86_s.jar" download="eager" />
</resources>
这不起作用,因为参数 sun.arch.data.model="64" 用于设置参数而不是对其进行测试.
This is not working because the parameter sun.arch.data.model="64" is used to set the parameter instead of testing on it.
有什么想法吗?
推荐答案
这在文档中有解释,这里:http://docs.oracle.com/javase/7/docs/technotes/guides/javaws/developersguide/syntax.html#resources
This is explained in the documentation, here: http://docs.oracle.com/javase/7/docs/technotes/guides/javaws/developersguide/syntax.html#resources
不过,它没有说明哪些 arch
值有意义.您可能希望它适用于不同的 JVM 实现和版本.我用谷歌搜索了一段时间,这是我最终使用的:
It doesn't say which arch
values make sense, though. You would want it to work for different JVM implementations and versions. I googled around for a while and here's what I've ended up using:
<resources>
<java version="1.6+"/>
<jar href="lwjgl-2.8.4.jar"/>
<jar href="lwjgl_util-2.8.4.jar"/>
</resources>
<!-- LWJGL Linux 64-bit native libraries -->
<resources os="Linux" arch="amd64">
<nativelib href="lwjgl-amd64-linux.jar"/>
</resources>
<resources os="Linux" arch="x86_64">
<nativelib href="lwjgl-amd64-linux.jar"/>
</resources>
<!-- LWJGL Linux 32-bit native libraries -->
<resources os="Linux" arch="x86">
<nativelib href="lwjgl-x86-linux.jar"/>
</resources>
<resources os="Linux" arch="i386">
<nativelib href="lwjgl-x86-linux.jar"/>
</resources>
<!-- LWJGL Windows 64-bit native libraries -->
<resources os="Windows" arch="amd64">
<nativelib href="lwjgl-amd64-win.jar"/>
</resources>
<resources os="Windows" arch="x86_64">
<nativelib href="lwjgl-amd64-win.jar"/>
</resources>
<!-- LWJGL Windows 32-bit native libraries -->
<resources os="Windows" arch="x86">
<nativelib href="lwjgl-x86-win.jar"/>
</resources>
<resources os="Windows" arch="i386">
<nativelib href="lwjgl-x86-win.jar"/>
</resources>
<!-- LWJGL MAC OS/X native libraries -->
<resources os="Mac">
<nativelib href="lwjgl-macosx.jar"/>
</resources>
这篇关于如何在 jnlp 文件中区分 32 位和 64 位 java 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!