views:

57

answers:

1

I have a single application that I am deploying via Java web Start. I have several different jnlp files for different launch scenarios. I am using DownloadService2 to check for updates periodically. When an update is available, I prompt the user. If they elect to update, I launch a new instance of javaws using Runtime.getRuntime().exec(), passing in the full jnlp url, then I System.exit(0). Effectively, this kicks off an update/restart cycle.

The problem is, since I could have started from one of several jnlp files, I can't simply hardcode the url. I know that I can get the host:port portion of the url from BasicService.getCodeBase(), but is there a way to get the file portion of the url? Currently I am adding a "jnlp" argument to the application-desc similar to the following so that I can retrieve it from args:

<application-desc main-class="my.main.class">
<argument>jnlp=myjnlp.jnlp</argument>
<application-desc/>

I think this will work, but I'm wondering if I am making it harder than it needs to be. Thanks.

A: 

Perhaps it would be best to provide this functionality using the DownloadService.

Andrew Thompson
I was aware of the DownloadService class, but I'm not sure how I can use it to get the name of the jnlp file for the currently running application. Can you elaborate?
ajh158
My apologies. I had misread the question and the DS will not solve the stated problem. :(
Andrew Thompson
No problem, thanks for responding.
ajh158