运行Jar应用程序时Java Web Start NumberFormatException [英] Java Web Start NumberFormatException while running Jar application

查看:196
本文介绍了运行Jar应用程序时Java Web Start NumberFormatException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

While trying to run Jar application using JWS (JNLP) launch. It has been giving me this error. Can't even find where is the mistake. Any directions would help.

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

If someone could tell me where is the potential location of this error, I could find post that code here.

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

Note: I have the latest Java 8 installed and working on Netbeans. The jar file works well if called manually, 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:

Posting this here in case someone has that very same error, even with java 8 Update 101:

在我们的特定情况下,经过几个小时的挖掘,问题最终导致NetBeans版本7.4放入了一些无用的垃圾jar的 MANIFEST.MF Codebase 属性;进入项目属性,应用程序 - > Web Start 然后将 Codebase 更改为用户定义 Codebase预览 * ,应用程序开始正常运行。

In our specific case, after a few hours of digging, the problem ended up being that NetBeans version 7.4 was putting some useless junk on the Codebase property of the jar's MANIFEST.MF; by going into the project properties, Application -> Web Start and then changing Codebase to User defined and Codebase Preview to *, the application started working correctly.

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

Please do keep in mind that we're using an applet instead of a JNLP application, so your mileage may vary.

这篇关于运行Jar应用程序时Java Web Start NumberFormatException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆