4

I have been fighting with this all day and I simply cannot figure out what I am doing wrong. I have a project in netbeans that I created a web start page for, as per the method in the netbeans tutorial but every time I try to run either the tutorial project or my project as a web start I get the following error:

java.lang.NumberFormatException: For input string: "\Users\<snip>"
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)

My jnlp file is:

 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="file:/C:/Users/<snip>/dist/" href="launch.jnlp" spec="1.0+">
    <information>
        <title>...</title>
        <vendor>me</vendor>
        <homepage href=""/>
        <description>...</description>
        <description kind="short">...</description>
    </information>
    <update check="background"/>
    <security>
<all-permissions/>
</security>
    <resources>
    <j2se version="1.8+"/>
    <jar eagar="true" href="<snip>.jar" main="true"/>

    </resources>
    <application-desc main-class="<snip>">
    </application-desc>
    </jnlp>

I would really appreciate help with this

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
user
  • 158
  • 6
  • 19
  • 1
    Be sure to check the JNLP using JaNeLA, available at my [share drive](https://drive.google.com/drive/#folders/0B5B9wDXIGw9lUnJaUjA2cmlVRE0). – Andrew Thompson Mar 23 '15 at 01:52
  • For some reason I think it is trying to set my path as an intiger – user Mar 23 '15 at 20:55
  • @user2352274 Try to remove the codebase part, which is now optional and upgrade your spec verions. For example: `` – assylias Mar 25 '15 at 09:58
  • Thanks for your comment, I gave that a shot but still I get the same error – user Mar 25 '15 at 11:10
  • @user2352274 That can only mean one of two things: (1) you are not running what you think you are running (if you completely remove the reference to C:/Users in your jnlp, you can't get an error that refers to it) - that could be due to caching or (2) the problem is somewhere in your jnlp that you have not shown... – assylias Mar 25 '15 at 18:32
  • To prevent caching you can add ``. Also I don't think that `eagar="true"` is allowed in the jar section. You may mean `download="eager"`... – assylias Mar 25 '15 at 18:34
  • I tried both of your suggestions but I still get the same error and I don't know why. I can only presume something is stored in cache because there no reference to the path at all in the jnlp. However I do reference dependencies like this in the resources section: `` Maybe that could be causing the problem? – user Mar 26 '15 at 15:04
  • I just tried placing the jars in the same location as the project jar and still I get the same error that I first got. The weird thing is that the path it gives me in the error is the path to the netbeans project folder when the source of the project is stored – user Mar 26 '15 at 15:09

4 Answers4

2

Just change your jnlp to this:

 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="file:/C:/MyFolder/" href="launch.jnlp" spec="1.0+">
    <information>
        <title>...</title>
        <vendor>me</vendor>
        <homepage href=""/>
        <description>...</description>
        <description kind="short">...</description>
    </information>
    <update check="background"/>
    <security>
<all-permissions/>
</security>
    <resources>
    <j2se version="1.8+"/>
    <jar eagar="true" href="MyJarFile.jar" main="true"/>

    </resources>
    <application-desc main-class="com.MyCompany.MyMainClass">
    </application-desc>
    </jnlp>

Edit: If this doesn't help or if you have a question about it add your comment below.

Saeid Nourian
  • 1,606
  • 15
  • 32
  • When I try your code, I get the exact same error, which is very confusing, as I can run the jar perfectly my simply opening it by not via jnlp – user Mar 25 '15 at 11:56
  • I'm sure the error from my code is different than yours. Your code has this error: java.lang.NumberFormatException: For input string: "\Users\". But my code doesn't have anywhere in it. So try my code again and let me know exactly what error you get. Also note that wherever I put "My..." you should replace it with your file names. For example change MyJarFile.jar to the actual name of your jar file. – Saeid Nourian Mar 25 '15 at 17:38
2

Try

file:///C:/Users/snip/dist/

in your codebase of your JNLP-XML.
File Uri-Scheme needs 2x // (file://)

EDIT:
No comment on this?

So, if this doesn't work, you can try following:
https://stackoverflow.com/a/2417010/3887073

which tells:

<jnlp spec="1.0+" codebase="file://localhost/X:/path/to/jnlp/" href="software.jnlp">
Community
  • 1
  • 1
Ben
  • 3,378
  • 30
  • 46
  • Sorry for the lack of comments, this still throws the same error which I am completely baffled by. – user Mar 29 '15 at 13:07
1

Make sure you are not using the path to your application as a value anywhere in your code. If the program accepts command-line arguments, try specifying the arguments as <argument></argument> sub-elements of <application-desc> in the JNLP file and running the Java Web Start program directly from the command line with

javaws path.to.ClassWithMainMethod
HpTerm
  • 8,151
  • 12
  • 51
  • 67
user196249
  • 11
  • 3
0

It seems that you are taking some kind of input from the user in your webstart application.

java.lang.NumberFormatException: For input string: "\Users\<snip>"
at java.lang.NumberFormatException.forInputString(Unknown Source)

Judging by this line, you requested the user to input an integer and they put in a string or something.

If you are not taking any user input, reinstalling NetBeans might help.

Cheers.

nom
  • 256
  • 3
  • 16
  • I convert a date to a string somewhere in the code but my application runs without any issue if I open the jar file. So it is quite weird. (and annoying) – user Mar 23 '15 at 20:31
  • 1
    Actually, looking at the stack trace, one can notice that the error occurs within com.sun.deploy.security.DeployManifestChecker.verifyCodebaseEx, which is responsible for verifying the application's signature. His code hasn't even been called, yet. – Haroldo_OK Oct 25 '16 at 10:23