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

时间:2012-03-31 18:50:56

标签: java jnlp launch java-web-start

我在网上搜索过并找不到明确的解决方案,所以请点击:

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

这是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>  

例外:

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$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

包装的例外:

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$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

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

1 个答案:

答案 0 :(得分:1)

我猜这个XML格式不正确:

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

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

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