tags:

views:

61

answers:

1

All my application I make with NetBeans as a Java Web Start applications behave quite strangely. When I run them as a normal application, everything works.

But when I compile them as java web start apps, they, after the java web start is done with loading, repeatedly ask server for libraries on the wrong place. It doesn't seem to matter in small projects, but it makes a huge time difference in large projects (see my first question).

I put a simple NetBeans project here. It should paint a window with a button that does nothing at all. (if you try to put it somewhere, upload the dist folder somewhere and edit the .jnlp file)

You can see from the logs (in logs.txt) that the libs are first downloaded fine from /awindow_dist/lib/, but then there comes a lot of requests to the wrong place, /awindow_dist/. What can be wrong? Everything seems to be configured fine.

Is it a NetBeans bug? A WebStart bug? Or my fault somehow?

+1  A: 

OK, it is definitely a bug in NetBeans, very probably in the build.xml file generated by NB.

I am kind of lost in the giant build.xml and build-impl.xml and jnlp-impl.xml, but my dirty workaround for Java Web Start to work in NetBeans is:

  1. copy the generated JNLP somewhere, because it is fine
  2. turn off the JWS in the NetBeans project
  3. instead of letting NetBeans to sign the .jar files, writing some shell script like this

    ant clean
    ant jar 
    #because these two works fine
    
    
    for i in `ls dist/*.jar; ls dist/lib/*.jar`
    do
       jarsigner -storepass mystorepass -keypass mykeypass $i myname
       #sign all the .jars
    done
    
    
    cp launch.jnlp dist/launch.jnlp 
    #copy the .jnlp
    
  4. make the script a target in the build.xml like this

Done. It's a dirty hack and works only with bash, because I don't really know how ant works + the build files, generated by netbeans, are really complicated. But it gets the work done.

Karel Bílek