下载后无法启动Java JNLP应用程序

时间:2014-01-18 11:05:59

标签: java jar java-web-start jnlp

我想包含我的java应用程序,我将其保存为Web浏览器中的jar文件。我已经尝试了Java Web Start教程并创建了Java JNLP应用程序。我还根据这里的教程:http://transvar.org/6112/WebStartAppInstruction.pdf

我已经尝试了所有步骤但是在我下载Launch.jnlp并尝试启动它之后弹出错误“无法启动应用程序”。我点击了详细信息按钮,检查我在哪里做错了。

这是错误(例外标签):

com.sun.deploy.net.FailedDownloadException: Unable to load resource: file:/C:/Users/nurulazila/Documents/NetBeansProjects/fyp_steganalysis/dist/$$codebase/launch.jnlp
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.Launcher.updateFinalLaunchDesc(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(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)

Wrapped Exception选项卡:

java.io.FileNotFoundException: C:\Users\nurulazila\Documents\NetBeansProjects\fyp_steganalysis\dist\$$codebase\launch.jnlp (The system cannot find the path 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.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.Launcher.updateFinalLaunchDesc(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(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)

我的代码(Launch.jnlp):

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="$$codebase" href="launch.jnlp" spec="1.0+">
    <information>
        <title>fyp_steganalysis</title>
        <vendor>nurulazila</vendor>
        <homepage href="www.google.com"/>
        <description>fyp_steganalysis</description>
        <description kind="short">fyp_steganalysis</description>
    </information>
    <update check="always"/>
    <resources>
        <j2se version="1.7+"/>
        <jar href="fyp_steganalysis.jar" main="true"/>
    </resources>
    <application-desc main-class="steganalysisUI">
    </application-desc>
</jnlp>

Launch.HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <title>Test page for launching the application via JNLP</title>
    </head>
    <body>
        <h3>Test page for launching the application via JNLP</h3>
        <script src="http://java.com/js/deployJava.js"></script>
        <script>
            deployJava.createWebStartLaunchButton("launch.jnlp")
        </script>
        <!-- Or use the following link element to launch with the application -->
        <!--
        <a href="launch.jnlp">Launch the application</a>
        -->
    </body>
</html>

我是Java JNLP的新手。希望在这里得到一些帮助。

1 个答案:

答案 0 :(得分:1)

根据链接文档,您需要对其进行编辑以找到application.i.e

的代码库
<jnlp codebase="http://webpages.uncc.edu/~acenglis" href="launch.jnlp"/>

我没有看到你完全遵循了教程(特别是编辑你的jnlp文件)