2

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

下面你会看到我的 JNLP 文件。Wehn 你看看资源你会注意到我有一些操作系统和体系结构独立的 jars,然后我有一些依赖于操作系统的 jars 和 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>
4

1 回答 1

5

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

下一个相关的资源属性是“arch”属性。此属性允许指定处理器架构。“arch”属性的相关值包括“x86”和“amd64”(即使是Intel 64bit)

您需要正确指定使用那些特定操作系统相关库的架构版本。
其他值可以是:

<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>

希望这可以帮助。

于 2013-03-06T10:35:06.163 回答