passing parameter via webstart

hi,

is it possible to:

  1. give parameters in the link to the jnlp file so that the app will be started with these arguments
    or
  2. have a jnlp file including parameters in it so that the app will be started with these arguments

The aim would be to make some sort of:
www…game.jnlp?join=12.34.56.789

Possible?

nr 2 is possible. Check out the jnlp file syntax:
http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/syntax.html#application_desc

[quote]
arg1
arg2

[/quote]
arg1 and arg2 will be the parameters sent to “public static void main(String args[])”

…then, is it possible to create temporary jnlp files on request (on the server side)?

  1. send a request to html, servlet or something else
  2. It handles request by sending back a custom made jnlp file.

Sure - you can dynamically generate one, just like any normal dynamic page. Just make sure you set the file type correctly, and if you want to hard-code it, you can just out.println() the XML to the client.

…well… i’m a bit nowhere in this area.
well, do you mean using php? or something similar?
…in that case, could help me out by giving me a small example how to write such a file (non html)?

php, perl, or any other server side code could automagically generate a .jnlp for you. It depends what you know and what you have avalible on your host.

But what exactly are you trying to do?

i’m doing a nasty, horrible, strange patchwork for a smart aim! (at least, i think so!)

The final aim, is to launch multiplayer games via messenger. yes, messenger.

You’ll invite somebody like following:
“Mofu wants to play pong with you! click here to play!”
By clicking, it’ll call a link => http://…/game.php?ip=0.0.0.0

which will create a custom jnlp file including the host IP as argument for the program which will try to connect to it when launched!
Tadam! You click accept and you play!

Well, that’s the theory! :-X

I have a small section in my JWS tutorial about dynamic JWS files: http://xith.org/tutes/GettingStarted/html/deploying_xith3d_games_with.html#SECTION000140500000000000000

Passing parameters to JWS can sometimes lead to unexpected results so I use Apache mod_rewrite to pretend that they are all actually seperate JNLP files. In that example essentially you can specify any class to run it: Eg if the main class is “CubeTest” then your JNLP is “com.xith3d.test.CubeTest.jnlp” but if it is SphereTest then it is “com.xith3d.test.SphereTest.jnlp”. Those two jnlp “files” actually translate to “com.xith3d.test.php?main=CubeTest” and “com.xithed.test.php?main=SphereTest” - but the user (ie. JWS) never knows.

Hope that helps,

Will.

thanks for the infos…