Webstart-deployed desktop app, command line and Windows ShellExecute.

Hi all,

I want to be able to associate Windows Shell registry actions (shellExecute from right click menu, double click, and protocols) with a Webstart Java Swing desktop app. This is pretty key to our deployment strategy.

I have two options that I'm pursuing right now.

OPTION A

Unfortunately I'm encountering a few problems:

1) javaws.exe does not accept parameters, therefore I can't pass parameters directly from a Windows command line

2) The only way to get arguments in is through the jnlp file. Sounds like this is possible using a jnlp written by a servlet. But can I just pass GET parameters to my servlet like so?

http://webstart.com/go/?param=value&param2=value2

Would that work?

2a) subissue: I want to use JNLP's SingleInstance to make sure that only one of my app is running at any time. It sounds like that JNLP interface also allows for new parameters to be passed in as arguments... but if I pass in parameters to my webstart address, will SingleInstance properly recognize that http://webstart/go and http://webstart/go?param=value are the same program?

OPTION B

So the alternative deployment strategy that I'm contemplating is using webstart, but then deploying a separate .jar to the machine and registering that to be the argument acceptor from Windows. So windows would run something like so:

java -jar cmdLauncher.jar argshere

From there I will do two things:

a) If the program is already running, then I pass the argument in using network sockets and deal with it like so.

b) If the program isn't already running, then I execute javaws http://myurl and then maybe write to the socket when it's ready. This might really suck since i'll have to poll until the socket is ready.

Anyway, was hoping someone with more webstart internals had some idea as to

a) would a option A (dynamic servlet) work in the way I expect?

b) Is option B the only way to really do it? It certainly seems feasible at this point.

Ideally I just wish javaws.exe allowed passing arguments, and thus this entire problem would not exist. It's a pretty powerful and important feature for WebStart to be able to be a fully featured deployment solution.

[2328 byte] By [garrytana] at [2007-11-27 9:03:06]
# 1

> OPTION A

> Unfortunately I'm encountering a few problems:

> 1) javaws.exe does not accept parameters, therefore I

> can't pass parameters directly from a Windows command

> line

>

> 2) The only way to get arguments in is through the

> jnlp file.

Or the SingleInstanceService.

>....Sounds like this is possible using a jnlp

> written by a servlet. But can I just pass GET

> parameters to my servlet like so?

> http://webstart.com/go/?param=value秏2=value

> 2

> Would that work?

Huh? Assuming the servlet that produces the

launch file fir this application is called 'go', and that

servlet returns the correct content-type, and writes

the two params in the URL into the JNLP as

arguments, then.. yes - this should work.

http://webstart.com/go?param=value秏2=value2

Note the lack of one '/'.

( I have not had much direct experience with

JNLP combined with servlets, but am familiar

with both. )

> 2a) subissue: I want to use JNLP's SingleInstance to

> make sure that only one of my app is running at any

> time. It sounds like that JNLP interface also allows

> for new parameters to be passed in as arguments...

> but if I pass in parameters to my webstart address,

> will SingleInstance properly recognize that

> http://webstart/go and http://webstart/go?param=value

> are the same program?

As I understand from my experience, the URL

becomes redundant, any params that were in

the JNLP are ignored in preference to the single

-open argument. Here is my buildable example..

http://www.physci.org/jws/#sis

...

> a) would a option A (dynamic servlet) work in the way

> I expect?

Sounds like it.

AndrewThompson64a at 2007-7-12 21:34:43 > top of Java-index,Desktop,Deploying...
# 2

Thanks for the help.

If I just needed to pass regular arguments, then I probably would have been fine. As it were, I am actually trying to pass my own protocol definition a la http, using Windows's HKEY_CLASSES_ROOT. So I have my own protocol://some/url that needs to be passed back into my Swing app, which is annoying because it would have to be escaped and passed into the web start URL.

I ended up implementing Option B -- it wasn't too bad at all. I deploy a launcher.jar to my application data directory, and register that jar with the registry directly, then use sockets to pass my parameters back into the running app.

garrytana at 2007-7-12 21:34:43 > top of Java-index,Desktop,Deploying...