无法启动应用程序

时间:2014-04-01 11:01:23

标签: java swing netbeans jnlp

嗨,我有一个java swing应用程序,我想通过jnlp启动它,我配置了我的项目Web启动配置但是当我按下启动按钮时不起作用。你知道为什么吗?

这是错误

Java.lang.NumberFormatException: For input string: "\Users\Administrator\Documents\NetBeansProjects\LoginPage\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.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)

2 个答案:

答案 0 :(得分:1)

由于此错误,我们只能告诉您,由于parseInt上的String不是int,您的问题才会发生。 要纠正这个问题,您有两种可能性:

  1. 添加try{}catch(NumberFormatException e){//show error}
  2. 断言您有parseInt;)
  3. 中的正确内容

答案 1 :(得分:0)

我有同样的问题 Netbeans 8.01,JDK 1.8u20,JRE项目,

运行选项:

  • '启用webstart'。

应用程序/ Webstart选项:

  • 创建证书密钥库(提示:我使用'portecle')
  • 代码库:本地执行(预览显示:'file:/ C:/..../')

项目创建的JNLP表示;

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="file:/C:/<snip>/dist/" href="launch.jnlp" spec="1.0+">
    <information>
        <title>netbeans_prj</title>
        <vendor>bla</vendor>
        <homepage href=""/>
        <description>netbeans_prj</description>
        <description kind="short">netbeans_prj</description>
    <offline-allowed/>
</information>
    <update check="background"/>
    <security>
<all-permissions/>
</security>
    <resources>
        <j2se java-vm-args="-Xmx512m -Xverify:none" version="1.7+"/>
        <jar href="netbeans_prj.jar" main="true"/>
    <jar href="lib/all_ext.jar"/>
</resources>
    <application-desc main-class="<snip>">
    <argument>-h</argument>
<argument>127.0.0.1</argument>
</application-desc>
</jnlp>