我正在尝试使用过时的JNLP资源调试问题,并希望更好地了解它们的实际工作方式 .

我正在使用JNLP文件从远程服务器运行应用程序 . 在我的测试中,我设法创建了一个副本JNLP,如下所示,它将从本地计算机中提取资源:

<?xml version="1.0" encoding="utf-8"?> 
<jnlp spec="1.0+" codebase="file:/C:/local/path/to/my/jnlp" href="Client.jnlp">
    <information>
        <title>Client</title>
        <description>Development Testing</description>
    </information>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <j2se version="1.7+" />
        <property name="jnlp.env" value="dev"/>   
        <jar href="lib/client.jar" main="true"/>
        <jar href="lib/Utils-1.3.6-SNAPSHOT.jar"/>
    </resources>
    <application-desc main-class="path.to.main.client.Class" />
</jnlp>

我在Eclipse中运行它,一切似乎按预期工作 . 然后我将JNLP文件从Eclipse复制到我的计算机上的另一个目录中,运行该文件,它再次按预期工作 .

然后我将保存的文件更改为以下文件:

<?xml version="1.0" encoding="utf-8"?> 
<jnlp spec="1.0+" codebase="file:/C:/local/path/to/my/jnlp" href="Client.jnlp">
    <information>
        <title>Client</title>
        <description>Development Testing</description>
    </information>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <j2se version="1.7+" />
        <property name="jnlp.env" value="dev"/>   
        <jar href="lib/client.jar" main="true"/>
        <jar href="lib/Utils-1.4.1-SNAPSHOT.jar"/>
    </resources>
    <application-desc main-class="path.to.main.client.Class" />
</jnlp>

当我重新在Eclipse之外复制JNLP时,它给了我一个错误,说它无法找到Utils-1.4.1-SNAPSHOT.jar文件 . 然而,在记事本中检查JNLP时,我看到 <resource> 条目仍然是Utils-1.3.6-SNAPSHOT.jar .

这最终导致了两个问题:

  • 下载并双击JNLP文件时,哪个文件确定在哪里查找资源(或查找哪个):本地副本或文件中定义的远程副本?我'm a bit confused as to why the JNLP I run lists one jar version in it, but the jar that is searched for is different. Other times I'运行相同的文件,似乎很好寻找1.3.6 . 我觉得's some part that I'失踪了 .

  • 这些文件和依赖项是否缓存在我可以实际查看的位置?我已经读过 C:\Users\<username>\AppData\LocalLow\Sun\Java\Deployment\cache\ 应该有这些文件,但我看到的唯一的东西有两个名为"security"和"6.0"的目录 . "6.0"文件夹包含在运行JNLP时似乎更新的文件和文件夹,但它们只是另一组编号为0-63的神秘文件夹,其中包含名称为十六进制字符串的文件 .

我很欣赏对这些事物内在运作的任何见解 .