5

Currently I have an app that is run via JNLP using Java web start. The user is able to hit a specific URL and launch this application just fine.

I'm able to add properties to the JNLP file itself inside of the build.xml (ant web start), by using j2seproperty tags, such as this.

<jw:j2se>

<j2seproperty name="testProperty" value="1"/>

</jw:j2se>

And these properties can be accessed anywhere in code via: System.getProperty("testProperty");

The problem is that I want to be able to set these properties via html, such as the following.

'http://localhost:8080/somelink?testProperty=2'

What are my options for achieving this? I've done some research and so far it seems that the only solution is to somehow dynamically create the JNLP launcher via a servlet of some sort.

Is this correct, and if not, are there other options here? If so, I'm open to all possibilities...

csciguy
  • 137
  • 1
  • 7

2 Answers2

1

Create the JNLP via a JSP page and have it fill in the property value from the request parameter. See this question for a slightly non-working example, but you should be able to fix it easily enough, I did.

Community
  • 1
  • 1
user207421
  • 305,947
  • 44
  • 307
  • 483
  • Is it possible to tie this into an existing setup that uses ant web start? I have a slew of tasks, etc, that must take place in the build.xml, and up to this point, building the jnlp was one of these tasks. – csciguy Jul 15 '12 at 15:08
  • Note that JSP becomes a servlet once by compiled. Why not use a servlet in the first place? – Andrew Thompson Jul 15 '12 at 23:40
  • EJP, is it possible for you to post your solution? I'm still having this issue. – csciguy Aug 21 '12 at 18:47
  • @AndrewThompson I'll ask that the other way around. Why not use a JSP? The notation is much closer to the final product. – user207421 Dec 08 '19 at 21:10
0

Another more flexible option is to embed an HTTP server using NanoHTTP and communicating with your JNLP app via Javascript or whatever you like.

Paul Gregoire
  • 9,715
  • 11
  • 67
  • 131