2013-07-10 38 views
2

我正在使用名爲JaNeLA的工具來檢查我的應用程序的JNLP文件。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'. One of '{description, icon, offline-allowed, shortcut, association, related-content}' is expected.這種情況在滿足上面的JNLP。

此外,它報告Invalid content was found starting with element 'update'. No child element is expected at this point.這個條件也符合我所看到的。

不確定爲什麼它報告(紅色)關於有效的JNLP內容。任何幫助將不勝感激。

+0

您是否諮詢過[JaNeLA幫助](http://pscode.org/janela/help.html)? –

+0

是的。幫助不大。 – Aspirant

+0

沒有太多的信息.​​.(和耐心穿veeery薄..) –

回答

1

此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,完全卸載當前的應用程序。使用Java控制面板,並加載新鮮。

+0

jnlp元素的順序真的很重要嗎? –

+0

@SaeidNourian即使它不是,你有一個實際的*理由*把元素放在一個不同的順序? –

+0

@ Andrew Thompson我只是好奇,如果你知道如果元素順序錯誤導致webstart問題的已知問題?在你的JaNeLA軟件中,它將錯誤的順序作爲「紅色」突出顯示,這可能意味着jnlp文件中的致命錯誤。如果這不是一個嚴重的問題,那麼爲什麼不把它變成綠色或黃色? –