简体   繁体   中英

File Not Found when using Java Web Start

I'm trying to use Java Web Start to replace a Java applet, but every time I run the .jnlp file either directly from the web server or directly from my computer it gives me an error.

I see the Java Web Start splash screen, and then the default progress bar appears. It downloads, and then verifies my jar, but shortly afterwards the following error message appears "Unable to launch the application".

CouldNotLoadArgumentException[ Could not load file/URL specified: C:\Users\[username]\AppData\Local\Temp\tmp_cache9015150161909242571.tmp]
    at com.sun.javaws.Main.launchApp(Unknown Source)
    at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
    at com.sun.javaws.Main.access$000(Unknown Source)
    at com.sun.javaws.Main$1.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Users\[username]\AppData\Local\Temp\tmp_cache9015150161909242571.tmp (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 com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
    at com.sun.javaws.Main.launchApp(Unknown Source)
    at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
    at com.sun.javaws.Main.access$000(Unknown Source)
    at com.sun.javaws.Main$1.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

I see no files in the Temp folder that look anything like tmp_cache.

Here is my JNLP file:

<?xml version="1.0" encoding="utf-8"?>

<jnlp spec="1.0+"
    codebase="http://localhost:2020/MyServer/applets"
    href="basicTest.jnlp">
    <information>
        <title>JWS Test</title>
        <vendor>My Company</vendor>
    </information>

    <resources>
        <j2se version="1.7+"
            href="http://java.sun.com/products/autodl/j2se"/>
        <jar href="basicTest.jar" main="true" />
    </resources>

    <application-desc
        name="Test Name"
        main-class="main.Entry">
    </application-desc>
    <update check="background"/>
</jnlp>

Things I've tried:

  • Downloading the JNLP file and the JAR from my web server (Works as expected)
  • Using a brand new, bare-bones jar with nothing but a main method and a System.out.print() statement (Same result)
  • Changing the href inside the .jnlp file (Different error message, can't find .jar, as expected. My server logs show this correctly as a 404)
  • Changing the value of the main-class attribute (Same result, suggests that the JVM never starts)
  • Running other example apps from Sun (These work correctly, either when running through the browser or when running downloaded .jnlp files)
  • Clearing my java cache and temp files (Same results)

I did wonder if the jars not being fully signed would matter (my jar is currently self-signed while in development) but I would expect a different error in that case.

It seems as though the jar file is downloaded into one location, and verified, but then can't be found when the JVM tries to start it. Could there be a cache location conflict?

其中一个原因可能是JRE 7以上的安全性很高。需要使用标识罐。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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