Java Web Start’s silly Self Reference

Dear Reader,

Just coming from having to push a Java Application out to the clients machine via Java Web Start. Everything went pretty well, after signing all the Jar’s. This, so they could sneak outside the “security sandbox” that Java Web Start plugs around downloaded applications.

The (maybe) unusual thing in our setup was, that the jnlp file had to be rendered on the fly. So there was never going to be a “on-disk” version of the file during the whole request, response cycle.

So, following the old “monkey see/monkey do” rule, my generated file looked a bit like this one:

[...]
jnlp spec="1.0+"
codebase="http://192.168.0.1/"
xhref="myapp.jnlp" mce_href="myapp.jnlp" // ignore the mce...
[...]

When trying to run this generated “file” through a link in the browser, silly web start tried to locate the file “http://192.168.0.1/myapp.jnlp”… HELLO? YOU ARE THIS FILE! STOP COMPLAINING YOU CANNOT FIND YOURSELF!

A quick look in the Java Web Start Tutorial hinted me to try to omit the href argument in the jnlp tag. Apparently, it is not needed. It then worked the way as I expected it to. But really, what is it good for anyway?

In the “spec” mentioned above, it says about the href attribute:

“The href specifies the URL of the JNLP file itself.”

Oh, that’s cute :-)

Thank you.

01
Ulon
July 6th, 2007 04:43

Well, in fact the URL is important.

JNLP files can be saved locally, it’s even possible to create shotcuts in the user desktop.

Consider the next JNLP code:

When executed, it will create a shortcut in your desk and force an online check every time the user runs the application (this is useful when you want to update in a transparent fashion).

Without the URL, the JNLP will be unable to find the source of the JAR’s and therefore the execution will fail.

Bear in mind that the JNLP file is supposed to be located in the client machine. The browser downloads it and then runs it. It isn’t run in the server side.

But i suppose that if you don’t need to create shorcuts it will work.
Does it work if you add like other jars, etc.??

Gruss,
Ulon.

02
Ulon
July 6th, 2007 04:44

sorry, code was not visible, lets try this:

03
Ulon
July 6th, 2007 04:45

mmm i give up! don’t know the metatag to show code :-(

Leave Your Comment

Name
Mail
Website
Comment