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

标签 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 上工作。 如果手动调用,jar 文件运行良好,java -jar testTool.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. 

最佳答案

在这里张贴这个以防有人有同样的错误,即使是 java 8 Update 101:

在我们的具体案例中,经过几个小时的挖掘,问题最终是 NetBeans 7.4 版在 jar 的 MANIFEST.MF< 的 Codebase 属性上放置了一些无用的垃圾;通过进入项目属性,Application -> Web Start 然后将 Codebase 更改为 User definedCodebase Preview*,应用程序开始正常工作。

请记住,我们使用的是小程序而不是 JNLP 应用程序,因此您的情况可能会有所不同。

关于运行 Jar 应用程序时 Java Web Start NumberFormatException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24828641/

相关文章:

java - 由于自签名或过时版本的安全异常,JDK 7u45 应用程序被阻止

Java Web Start - JNLP 资源 - Jars 和类?

java - 为什么编译包含静态嵌套类的类会创建一个名为 "EnclosingClass$1"的新 .class 文件?

java - 与元素类型 "from"关联的属性名称 "Hello"后面必须跟有 ' = ' 字符。 - Apache Camel

java - Activity 开始且未选中复选框时出现 NullPointerException

Java Eclipse 文本编辑器

java - 将 Java Web Start jar 与 Web 应用程序集成

java - 如何检测 Java Web Start 何时/为何无法为用户启动

Java Web Start 在运行时不会下载更新的应用程序

java - 超微 IPMI KVM : remote connection without webbrowser