JNLP不下载OS资源

时间:2013-03-05 16:24:51

标签: java jnlp java-web-start

我有一个程序,我一直在写,使用WebStart,我似乎遇到了一个问题。我注意到无论我做什么,我都无法让WebStart下载特定于操作系统的jar。

下面你会看到我的JNLP文件。你看看你会注意到的资源我有一些独立于操作系统和架构的jar,然后我有一些依赖于操作系统的jar和nativelibs。

目前核心和通用文件夹中的所有内容都将正确加载,但没有其他内容。如果我创建一个单独的jnlp文件来链接我的计算机所需的所有内容,它将下载并加载得很好(几乎没有什么小问题可以解决)。

这是我的JNLP文件,您看到可能出现的问题吗?

<?xml version='1.0' encoding='utf-8' ?>
<jnlp
    spec="1.0+"
    codebase="http://xxxx.xxxxxxxxxxxxxxxx.xxx/java/"
    href="MyApp.jnlp?k=14&amp;d=dGMDES%2Bgs0A3d03HbVKkD4T7ONIby1a5NZGMVkwHzsV7tydBs2eoPvyHfeXlNpcxD8H8Wt1kRePtxBuOswZ%2FxA%3D%3D">
    <information>
        <title>Program Name</title>
        <vendor>Company</vendor>
        <description></description>
        <description kind="short"</description>
    </information>
    <update check="always" policy="always" />
    <resources>
        <j2se version="1.7+" href="http://java.sun.com/products/autodl/j2se" />
        <property name="sun.awt.disableMixing" value="false"/>
        <jar href="core/Utilities.jar" size="146289" main="false" download="lazy" />
        <jar href="core/DPFP.jar" size="40239" main="false" download="lazy" />
        <jar href="core/SigPad.jar" size="8293" main="false" download="lazy" />
        <jar href="core/SoapService.jar" size="741035" main="false" download="lazy" />
        <jar href="core/Marketing.jar" size="857781" main="false" download="lazy" />
        <jar href="core/App.jar" size="1172429" main="true" download="eager" />
        <jar href="core/Element.jar" size="506791" main="false" download="lazy" />
        <jar href="universal/ekitspell.jar" size="330488" main="false" download="lazy" />
        <jar href="universal/DJNativeSwing.jar" size="111941" main="false" download="lazy" />
        <jar href="universal/DJNativeSwing-SWT.jar" size="580006" main="false" download="lazy" />
        <jar href="universal/SigPlus2_57.jar" size="125633" main="false" download="lazy" />
        <jar href="universal/japura.jar" size="296730" main="false" download="lazy" />
        <jar href="universal/miglayout15-swing.jar" size="81697" main="false" download="lazy" />
        <jar href="universal/ekit.jar" size="171833" main="false" download="lazy" />
        <jar href="universal/RXTXcomm.jar" size="67856" main="false" download="lazy" />
        <jar href="universal/commons-codec-1.7.jar" size="281608" main="false" download="lazy" />
        <jar href="universal/json_simple-1.1.jar" size="18827" main="false" download="lazy" />
    </resources>
<resources os="Linux">
    <nativelib href="lib/linux/SigUsb.jar" size="108657" download="eager" />
    <nativelib href="lib/linux/rxtx-native-linux.jar" size="175917" download="eager" />
    <jar href="linux/dpfpenrollment.jar" size="334610" main="false" download="lazy" />
    <jar href="linux/dpfpverification.jar" size="37114" main="false" download="lazy" />
    <jar href="linux/dpotapi.jar" size="67688" main="false" download="lazy" />
    <jar href="linux/dpotjni.jar" size="14398" main="false" download="lazy" />
</resources>
<resources os="Mac\ OS">
    <jar href="mac/OS/swt_mac.jar" size="1794474" main="false" download="lazy" />
</resources>
<resources os="Mac\ OS X">
    <nativelib href="lib/mac/OSX/rxtx-native-macosx.jar" size="111183" download="eager" />
    <jar href="mac/OSX/swt_mac.jar" size="1794474" main="false" download="lazy" />
</resources>
<resources os="Windows" arch="x86">
    <nativelib href="lib/windows/rxtx-native-windows.jar" size="178321" download="eager" />
    <nativelib href="lib/windows/x86/SigUsb.jar" size="39385"  download="eager" />
    <jar href="windows/dpfpenrollment.jar" size="334610" main="false" download="lazy" />
    <jar href="windows/dpfpverification.jar" size="37114" main="false" download="lazy" />
    <jar href="windows/dpotapi.jar" size="67688" main="false" download="lazy" />
    <jar href="windows/dpotjni.jar" size="14398" main="false" download="lazy" />
    <jar href="windows/x86/swt_windows_x86.jar" size="2007870" main="false" download="lazy" />
</resources>
<resources os="Windows" arch="x86_64">
    <nativelib href="lib/windows/rxtx-native-windows.jar" size="178321" download="eager" />
    <nativelib href="lib/windows/x86_64/SigUsb.jar" size="48092"  download="eager" />
    <jar href="windows/dpfpenrollment.jar" size="334610" main="false" download="lazy" />
    <jar href="windows/dpfpverification.jar" size="37114" main="false" download="lazy" />
    <jar href="windows/dpotapi.jar" size="67688" main="false" download="lazy" />
    <jar href="windows/dpotjni.jar" size="14398" main="false" download="lazy" />
    <jar href="windows/x86_64/swt_windows_x86_64.jar" size="2064877" main="false" download="lazy" />
</resources>
    <application-desc main-class="opt.companyname.app.Main">
        <argument>k=14</argument>
        <argument>d=dGMDES+gs0A3d03HbVKkD4T7ONIby1a5NZGMVkwHzsV7tydBs2eoPvyHfeXlNpcxD8H8Wt1kRePtxBuOswZ/xA==</argument>
    </application-desc>
    <security>
        <all-permissions/>
    </security>
</jnlp>

1 个答案:

答案 0 :(得分:5)

Java Web Start描述符中的“Resource”标记有两个关键元素,可以实现高效的Java应用程序部署。资源标记的一个重要属性是“os”属性。此属性允许您为应用程序的部署指定特定平台。 “os”属性中的选项可以是“Windows”,“Linux”,“Mac OS X”等。

下一个相关资源属性是“arch”属性。该属性允许规范处理器体系结构。 “arch”属性的相关值包括“x86”和“amd64”(即使对于Intel 64位)

您需要正确指定使用这些特定操作系统依赖库的 arch 版本 其他 arch 值可以是:

<resources os="Linux"  arch="i386 x86" >  
...
</resources>

<resources os="Linux"  arch="amd64" >  
...
</resources>

<resources os="Windows"  arch="x86" >  
...
</resources>

<resources os="Windows"  arch="amd64" >  
...
</resources>

<resources os="Mac\ OS\ X" arch="x86_64" >  
...
</resources>

<resources os="Mac\ OS\ X" arch="i386 x86">  
...
</resources>

希望这有帮助。