运行Jar应用程序时Java Web Start NumberFormatException

时间:2014-07-18 15:26:26

标签: java java-web-start jnlp numberformatexception

尝试使用JWS(JNLP)启动时运行Jar应用程序。它一直在给我这个错误。甚至找不到错误的地方。任何指示都会有所帮助。

如果有人可以告诉我这个错误的潜在位置在哪里,我可以在这里发现该代码。

java.lang.NumberFormatException: For input string: "\Tools_Dev\TestApp\dist"
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at com.sun.deploy.security.DeployManifestChecker.verifyCodebaseEx(Unknown Source)
    at com.sun.deploy.security.DeployManifestChecker.verifyCodebase(Unknown Source)
    at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
    at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
    at com.sun.javaws.security.AppPolicy.grantUnrestrictedAccess(Unknown Source)
    at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
    at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
    at com.sun.javaws.Launcher.prepareResources(Unknown Source)
    at com.sun.javaws.Launcher.prepareAllResources(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)

注意:我安装了最新的Java 8并在Netbeans上工作。 如果手动调用java -jar testTool.jar

,jar文件的效果很好

更新

JNLP文件内容:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="file:/C:/Tools_Dev/TestApp/dist/" href="launch.jnlp" spec="1.0+">
    <information>
        <title>Java Tool Update Test</title>
        <vendor>Local</vendor>
        <description>Test Tool</description>
        <offline-allowed/>
    </information>
    <security>
        <all-permissions/>
    </security>
    <update check="background"/>
    <resources>
        <j2se version="1.7+"/>
        <jar href="Java-Tool-Update-Test.jar" main="true"/>
        <jar href="lib/sqlite-jdbc-3.7.15-M1.jar"/>
        <jar href="lib/poi-3.10-FINAL-20140208.jar"/>
        <jar href="lib/poi-ooxml-3.10-FINAL-20140208.jar"/>
        <jar href="lib/poi-ooxml-schemas-3.10-FINAL-20140208.jar"/>
        <jar href="lib/dom4j-1.6.1.jar"/>
        <jar href="lib/xmlbeans-2.3.0.jar"/>
        <jar href="lib/jaxen-1.1.6.jar"/>
    </resources>
    <application-desc main-class="Tool.Test.Main">
    </application-desc>
</jnlp>

JaNeLa工具中提示错误,不包括警告和优化:

JaNeLA Report - version 11.05.17
cvc-complex-type.2.4.a: Invalid content was found starting with element 'security'. One of '{resources, application-desc, applet-desc, component-desc, installer-desc}' is expected.
cvc-complex-type.2.4.a: Invalid content was found starting with element 'security'. One of '{resources, application-desc, applet-desc, component-desc, installer-desc}' is expected.
Lazy downloads might not work as expected for lib/sqlite-jdbc-3.7.15-M1.jar unless the download 'part' is specified. 
Lazy downloads might not work as expected for lib/poi-3.10-FINAL-20140208.jar unless the download 'part' is specified. 
Lazy downloads might not work as expected for lib/poi-ooxml-3.10-FINAL-20140208.jar unless the download 'part' is specified. 
Lazy downloads might not work as expected for lib/poi-ooxml-schemas-3.10-FINAL-20140208.jar unless the download 'part' is specified. 
Lazy downloads might not work as expected for lib/dom4j-1.6.1.jar unless the download 'part' is specified. 
Lazy downloads might not work as expected for lib/xmlbeans-2.3.0.jar unless the download 'part' is specified. 
Lazy downloads might not work as expected for lib/jaxen-1.1.6.jar unless the download 'part' is specified. 

2 个答案:

答案 0 :(得分:3)

如果有人有同样的错误,即使使用java 8 Update 101:

,也会在此处发布此信息

在我们的特定情况下,经过几个小时的挖掘,问题最终是NetBeans版本7.4在jar Codebase的{​​{1}}属性上放了一些无​​用的垃圾;通过进入项目属性MANIFEST.MF,然后将Application -> Web Start更改为CodebaseUser defined更改为Codebase Preview,应用程序开始正常运行。

请注意我们使用小程序代替JNLP应用程序,因此您的里程可能会有所不同。

答案 1 :(得分:2)

看起来像一个已知问题...请参阅Bug #236765

按照错误中的说明升级您的Java版本。

  

不是NB问题,javaws问题。我已经测试过了   https://netbeans.org/kb/73/java/javase-jws.html与JDK 1.7.0_45和   工作正常。请更新JDK JRE。