java Jnlp 无法解析启动文件。第 0 行错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9958693/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 23:03:39  来源:igfitidea点击:

Jnlp Could not parse launch file. Error at line 0

javajnlplaunchjava-web-start

提问by J3RN

I have searched the web and have found no definitive solution, so here goes:

我在网上搜索并没有找到明确的解决方案,所以这里是:

I made a JNLP file to launch a JAR in the same folder, however it fails to launch and gives the error "Could not parse launch file. Error at line 0."

我制作了一个 JNLP 文件以在同一文件夹中启动 JAR,但是它无法启动并给出错误“无法解析启动文件。第 0 行错误。”

Here's DevChat.jnlp:

这是 DevChat.jnlp:

<?xml version="1.0" encoding="utf-8"?> 
<!-- JNLP to Launch DevChat -->
<jnlp 
    spec="1.0+"
    href="DevChat.jnlp">

    <information>
        <title>DevChat</title>
        <vendor>Dev Team</vendor>
    </information>

    <security>
        <all-permissions/>
    </security>

    <resources>
    <j2se version="1.4.2"/>
        <jar href="DevSuite.jar" main="true" />
    <jar href="commons-net-3.0.1.jar" />
    </resources>

    <application-desc 
    main-class="DevChat"
        name="DevChat"
     </application-desc>

</jnlp>  

And the exception:

和例外:

JNLParseException[ Could not parse launch file. Error at line 0.]
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(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.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

And the wrapped exception:

和包装的异常:

java.lang.NullPointerException
at com.sun.deploy.xml.XMLParser.parseXMLAttribute(Unknown Source)
at com.sun.deploy.xml.XMLParser.parseXMLElement(Unknown Source)
at com.sun.deploy.xml.XMLParser.parseXMLElement(Unknown Source)
at com.sun.deploy.xml.XMLParser.parseXMLElement(Unknown Source)
at com.sun.deploy.xml.XMLParser.parseXMLElement(Unknown Source)
at com.sun.deploy.xml.XMLParser.parseXMLElement(Unknown Source)
at com.sun.deploy.xml.XMLParser.parse(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(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.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Running from console shows nothing at all. Any help would be appreciated!

从控制台运行根本不显示任何内容。任何帮助,将不胜感激!

采纳答案by jordeu

I guess that this XML is malformed:

我猜这个 XML 格式不正确:

<application-desc 
    main-class="DevChat"
    name="DevChat"
</application-desc>

you need to close the open tag like this:

你需要像这样关闭打开的标签:

<application-desc 
    main-class="DevChat"
    name="DevChat">
</application-desc>