2012-05-15 84 views
3

遠程運行Java Web Start應用程序時出現問題。在本地運行時,不存在這種問題。問題是,jar文件沒有部署到本地temp文件夾(正確部署jnlp文件),因此FileNotFound異常被拋出到Java控制檯。通過遠程訪問未找到java web start jar文件

任何人都可以幫忙嗎?

的index.html:

<body> 
<!-- ... --> 
<script src= 
    "http://www.java.com/js/deployJava.js"></script> 
<script> 
    // using JavaScript to get location of JNLP 
    // file relative to HTML page 
    var dir = location.href.substring(0, 
     location.href.lastIndexOf('/')+1); 
    var url = dir + "myapp.jnlp"; 
    deployJava.createWebStartLaunchButton(url, '1.6.0'); 
</script> 
<!-- ... --> 

JNLP文件:

<?xml version="1.0" encoding="UTF-8"?> 
<jnlp spec="1.0+" codebase="" href=""> 
<information> 
    <title>mytitle</title> 
    <vendor>mycompany</vendor> 
    <offline-allowed/> 
</information> 
<resources> 
    <!-- Application Resources --> 
    <j2se version="1.6+" href= 
     "http://java.sun.com/products/autodl/j2se"/> 
    <jar href="myapp.jar" 
     main="true" /> 

</resources> 
<application-desc 
    name="My Application"> 
</application-desc> 
<update check="background"/> 

Java控制檯拋出: 異常:

com.sun.deploy.net.FailedDownloadException: Unable to load resource: file:/C:/DOCUME~1/myhome/LOCALS~1/Temp/myapp.jar 
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source) 
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source) 
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source) 
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source) 
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source) 
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source) 
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source) 
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) 
at java.util.concurrent.FutureTask.run(Unknown Source) 
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
at java.lang.Thread.run(Unknown Source) 

包裝異常:

java.io.FileNotFoundException: C:\DOCUME~1\myhome\LOCALS~1\Temp\myapp.jar (The system cannot find the file specified) 
at java.io.FileInputStream.open(Native Method) 
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.doRequest(Unknown Source) 
at com.sun.deploy.net.BasicHttpRequest.doGetRequest(Unknown Source) 
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source) 
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source) 
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source) 
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source) 
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source) 
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source) 
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source) 
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) 
at java.util.concurrent.FutureTask.run(Unknown Source) 
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
at java.lang.Thread.run(Unknown Source) 
+0

可能相關:http://stackoverflow.com/questions/1260950/launch-runnable-jar-from-web-start – assylias

回答

2

必須指定href和代碼庫Java Web Start的正確的價值觀才能正常工作。原因是啓動程序可能選擇調用一個新的JVM,並給出JNLP腳本的緩存副本,而不需要返回到原始版本。

+0

是的,這有幫助。謝謝。 – xMichal

相關問題