gpt4 book ai didi

java - JaNeLA 报告有关有效 JNLP 的错误

转载 作者:行者123 更新时间:2023-11-30 11:30:47 26 4
gpt4 key购买 nike

我正在使用一个名为 JaNeLA 的工具来检查我的应用程序的 JNLP 文件。

我的 JNLP 是:

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="6.0+" xmlns:jfx="http://javafx.com" codebase="http://myserver.com/downloads">
<information>
<title>My App</title>
<vendor>My Vendor</vendor>
<description>Application to do something</description>
<homepage href="http://myserver.com/myapp" />
<offline-allowed/>
<shortcut online="true">
<desktop/>
<menu submenu="My App"/>
</shortcut>
</information>

<security>
<all-permissions/>
</security>

<resources>
<j2se version="1.7.0_25" java-vm-args="-Xmx1024m -Djava.net.preferIPv4Stack=true" href="http://java.sun.com/products/autodl/j2se"/>
<property name="myID" value="1" />
</resources>

<resources os="Windows" arch="x86">
<jar href="my-app-0.0.1.jar" download="eager" />
</resources>

<resources os="Windows" arch="amd64">
<jar href="map-app-0.0.1.jar" download="eager" />
</resources>

<application-desc main-class="com.myApp.MyApp"/>

<update check="always"/>

</jnlp>

它报告了:

JaNeLA Report - version 11.05.17


Report for file:/C:/Users/Desktop/myapp.jnlp

Content type application/xml does not equal expected type of application/x-java-jnlp-file
cvc-complex-type.2.4.a: Invalid content was found starting with element 'homepage'. One of '{description, icon, offline-allowed, shortcut, association, related-content}' is expected.
cvc-complex-type.2.4.a: Invalid content was found starting with element 'homepage'. One of '{description, icon, offline-allowed, shortcut, association, related-content}' is expected.
cvc-complex-type.2.4.d: Invalid content was found starting with element 'update'. No child element is expected at this point.
cvc-complex-type.2.4.d: Invalid content was found starting with element 'update'. No child element is expected at this point.
XML encoding not known, but declared as utf-8
Codebase + href 'http://myserver.com/C:/Users/Desktop/myapp.jnlp' is not equal to actual location of 'file:/C:/Users/Desktop/myapp.jnlp'.
Desktop icons were subject to bug nnnn in earlier J2SE versions
Downloads can be optimized by specifying a resource size for 'myapp-0.0.1.jar'.
The resource download at myapp-0.0.1.jar can be optimized by removing the (default) value of download='eager'.
The resource download at myapp-0.0.1.jar can be optimized by removing the (default) value of main='false'.
It might be possible to optimize the start-up of the app. by specifying download='lazy' for the myapp-0.0.1.jar resource.
Lazy downloads might not work as expected for myapp-0.0.1.jar unless the download 'part' is specified.
Downloads can be optimized by specifying a resource size for 'myapp-0.0.1.jar'.
The resource download at myapp-0.0.1.jar can be optimized by removing the (default) value of download='eager'.
The resource download at myapp-0.0.1.jar can be optimized by removing the (default) value of main='false'.
It might be possible to optimize the start-up of the app. by specifying download='lazy' for the myapp-0.0.1.jar resource.
Lazy downloads might not work as expected for myapp-0.0.1.jar unless the download 'part' is specified.

我不确定的是 JaNeLA 报告存在无效内容,即 Invalid content was found starting with element 'homepage'。需要“{description, icon, offline-allowed, shortcut, association, related-content}”之一。 在上面的 JNLP 中满足此条件。

此外,它还报告有关 发现以元素“update”开头的无效内容。此时不需要子元素。 根据我所见,也满足此条件。

不确定它为什么报告(红色)有效的 JNLP 内容。任何帮助将不胜感激。

最佳答案

此 JNLP 以正确的顺序放置元素。请注意,两个 元素都是通过将元素进一步移到文档中 来固定的 - 就像我上面建议的那样。

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="6.0+" xmlns:jfx="http://javafx.com" codebase="http://myserver.com/downloads">
<information>
<title>My App</title>
<vendor>My Vendor</vendor>
<homepage href="http://myserver.com/myapp" />
<description>Application to do something</description>
<offline-allowed/>
<shortcut online="true">
<desktop/>
<menu submenu="My App"/>
</shortcut>
</information>
<security>
<all-permissions/>
</security>
<update check="always"/>
<resources>
<j2se version="1.7.0_25" java-vm-args="-Xmx1024m -Djava.net.preferIPv4Stack=true" href="http://java.sun.com/products/autodl/j2se"/>
<property name="myID" value="1" />
</resources>
<resources os="Windows" arch="x86">
<jar href="my-app-0.0.1.jar" download="eager" />
</resources>
<resources os="Windows" arch="amd64">
<jar href="map-app-0.0.1.jar" download="eager" />
</resources>
<application-desc main-class="com.myApp.MyApp"/>
</jnlp>

另一个问题,换个JNLP,彻底卸载当前的app。使用 Java 控制面板,并重新加载它。

关于java - JaNeLA 报告有关有效 JNLP 的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17578061/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com