Java file jar file not found through remote access

I have a problem starting a Java Web Start application remotely. When starting locally, there is no such problem. The problem is that the jar file does not expand to the local temp folder (the jnlp file is deployed correctly), so the FileNotFound exception is passed to the Java console.

Can anyone help?

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:

<?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:

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)
+3
source share
1 answer

You must specify the correct values ​​for href and codebase for Java Web Start to work properly. The reason is that the launcher may choose to invoke a new JVM, given the cached copy of the JNLP script without reference to the original.

+2

All Articles