简体   繁体   English

通过远程访问找不到java web start jar文件

[英]java web start jar file not found via remote access

I've got a problem by running a Java Web Start application remotely. 我通过远程运行Java Web Start应用程序遇到了问题。 When run locally, there's not this kind of problem. 在本地运行时,不存在这种问题。 The problem is, that the jar file is not deployed to the local temp folder (jnlp file is deployed correctly), so the FileNotFound exception is thrown to the Java Console. 问题是,jar文件未部署到本地临时文件夹(正确部署了jnlp文件),因此将FileNotFound异常抛出到Java控制台。

Can anyone help? 有人可以帮忙吗?

index.html: 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 file: 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 console throws: Exception: 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)

Wrapped exception: 包装异常:

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)

You must specify proper values for href and codebase for Java Web Start to work properly. 必须为href和codebase指定正确的值才能使Java Web Start正常工作。 The reason is that the launcher may choose to invoke a new JVM given a cached copy of the JNLP script with no ties back to the original. 原因是启动程序可以选择在给定JNLP脚本的缓存副本的情况下调用新的JVM,而不与原始脚本相关联。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM