我有一個通過JNLP分發的應用程序。這很好,除了少數幾個地方沒有足夠的互聯網連接來下載應用程序(T1連接)。讓JNLP安裝在本地機器上工作
我通過創建可放在磁盤上的軟件包,複製並讓JNLP文件在本地運行來獲取它們的應用程序。
JNLP文件現在看起來是這樣的:
<jnlp spec="7.0+" href="launch.jnlp">
<information>
<title>EAGLE TEST</title>
<icon href="img/splash.png" kind="splash"/>
<icon href="img/icon.png"/>
<offline-allowed/>
<shortcut online="false" install="true">
<desktop />
<menu sub-menu="EAGLE"/>
</shortcut>
</information>
<update check="timeout" policy="prompt-run"/>
<security>fsddf
<all-permissions/>
</security>
<resources>
<j2se version="1.8+" initial-heap-size="128m" max-heap-size="512m" />
<property name="jnlp.versionEnabled" value="true"/>
<jar href="eagle-client-core.jar" version="2.2.0-b4" main="true"/>
<jar href="biometric-services-commons.jar" version="1.2"/>
<jar href="jackson-annotations.jar" version="2.4.3"/>
</resources>
<application-desc main-class="foo.bar.baz.client.Main">
</application-desc>
</jnlp>
看起來不錯。然而,當我運行launch.jnlp文件我得到一個異常:
com.sun.deploy.net.FailedDownloadException: Unable to load resource: (file:/C:/Users/me/path/app/webstart/eagle-client-core.jar?version-id=2.2.0-b4, 2.2.0-b4)
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.downloadResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
用的包裝異常:
java.io.FileNotFoundException: C:\Users\me\path\app\webstart\eagle-client-core.jar (The system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(Unknown Source)
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.downloadResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
現在,這表明該文件無法找到。但是,路徑
C:\Users\me\path\app\webstart\eagle-client-core.jar
是正確的路徑。我也嘗試在JNLP文件中指定代碼庫,因爲
file:///C:/Users/me/path/app/webstart/launch.jnlp
我得到相同的錯誤:無法找到指定的文件。
我一直無法找出JNLP無法加載本地資源的潛在原因。我已經用反斜槓作爲前向窗口,以及其他許多變體。
我已經使用了JaNeLA工具,它給出了相同的錯誤,但沒有說明如何解決它:問題獲取資源eagle-client-core.jar C:\ Users \ me \ path \ app \ webstart \ eagle-client-core.jar(系統找不到指定的文件。)
任何有關阻止系統找到文件的信息將不勝感激。
Java文檔說它應該使用本地文件系統,而在我的環境中,最簡單,最不復雜的解決方案將是必需的。 –
最後它可以在沒有本地web服務器的情況下完成。將代碼庫添加到您的jnlp中。codebase =「file:/ path/to/your/jnlp /」 然後將相同的路徑添加到jcontrol中的Exception Site List。 這項工作對我來說就是java 8u73。 –
我發現添加代碼庫並添加到異常站點列表不會改變任何東西。我添加了以下內容:file:/// C:/ Users/zmelnic/clientWAR/EAGLE_CLIENT/webstart file:// C:/ Users/me/path/app/webstart file:// C:/ Users /我/路徑/應用/在webstart /啓動。jnlp file:// C:\ Users \ me \ path \ app \ webstart 沒有任何改變。看起來,異常站點列表並不是問題,因爲JavaWS能夠找到並加載launch.jnlp文件。它在讀取文件後下載窒息。 –