|
Replies:
8
-
Last Post:
Aug 18, 2006 10:52 AM
by: anilp1
|
Threads:
[
Previous
|
Next
]
|
|
|
|
|
|
Can my application know the location of the jnlp file that launched it?
Posted:
Aug 10, 2006 8:20 PM
|
|
|
Can my application know the location of the jnlp file that launched it? Or, is there some workaround that will allow relative references?I have a folder on the client desktop that contains some data files and the jnlp file. The folder is not on the webserver, though the jars were originally downloaded from there. When the user clicks on it, it launches the application, and passes in the <argument> tag, the relative path of the datafile. for example, ../mydata1.txt. Passing in the relative path is good because (like html), the folder can be moved to another location or emailed, and the application still work. Does anyone know how to do this? thanks, Anil Philip goodnewsforyou A T yahoo D O T com P.S. my application is digitally signed so I am not using the basic and other jnlp services.
I want the location of the jnlp file. This will allow the application to access the data files in the folder that contains it. This will likely be on the client. If html provides for relative urls, why cant jnlp?!!! This is rather urgent for me so any help appreciated.
|
|
|
|
|
|
|
Re: Can my application know the location of the jnlp file that launched it?
Posted:
Aug 11, 2006 5:53 AM
in response to: anilp1
|
|
|
We do it by having the JNLP servlet patch the location in as an <argument> to the application that is the codebase.
|
|
|
|
|
|
|
|
Re: Can my application know the location of the jnlp file that launched it?
Posted:
Aug 11, 2006 6:31 AM
in response to: alski
|
|
|
> We do it by having the JNLP servlet patch the > location in as an <argument> to the application that > is the codebase.
That is not useful here! If webstart allows the application to run offline, then each time the jnlp file is moved on the client's local desktop, will the server have to update it each time?
Why doesnt the application have access to the location of the jnlp file? that way, relative location references would be possible.
thanks, Anil
|
|
|
|
|
|
|
|
Re: Can my application know the location of the jnlp file that launched it?
Posted:
Aug 11, 2006 8:35 AM
in response to: anilp1
|
|
|
I use BasicService.getCodeBase(). This service is always available regardless of the security settings or whether the jars are signed.
Neil
|
|
|
|
|
|
|
|
Re: Can my application know the location of the jnlp file that launched it?
Posted:
Aug 11, 2006 9:26 AM
in response to: neilweber
|
|
|
> I use BasicService.getCodeBase(). This service is > always available regardless of the security settings > or whether the jars are signed. > > Neil
Thanks for replying. How will that help? As per my understanding, getCodeBase() will simply return the URL of the jar on the server.
I want the location of the jnlp file. This will allow the application to access the data files in the folder that contains it. This will likely be on the client. If html provides for relative urls, why cant jnlp?!!! This is rather urgent for me so any help appreciated.
|
|
|
|
|
|
|
|
Re: Can my application know the location of the jnlp file that launched it?
Posted:
Aug 11, 2006 11:27 AM
in response to: anilp1
|
|
|
Oh, I thought you wanted to know the location of the JNLP on the server.
I don't know how to get the location of the JNLP. It's probably stored in the browsers cache since it is the browser that downloads the JNLP and then invokes Java WebStart.
I don't know what you're trying to do, but I can't think of why you'd want to know where the JNLP is stored locally. If you're trying to get at resources (icons, property files, etc) that you're providing, the resources should go into one of your jars and then you'd use the standard Java resource location mechanisms (e.g. Thread.currentThread().getContextClassLoader().getResource(imageName)). That's what I'm doing and the code runs fine standalone or via Java Webstart.
Neil
|
|
|
|
|
|
|
|
Re: Can my application know the location of the jnlp file that launched it?
Posted:
Aug 11, 2006 11:48 AM
in response to: neilweber
|
|
|
Sorry, but yet again it looks like you have not read the question.  - Anil
> Oh, I thought you wanted to know the location of the > JNLP on the server. > > I don't know how to get the location of the JNLP. > It's probably stored in the browsers cache since it > t is the browser that downloads the JNLP and then > invokes Java WebStart. > > I don't know what you're trying to do, but I can't > think of why you'd want to know where the JNLP is > stored locally. If you're trying to get at resources > (icons, property files, etc) that you're providing, > the resources should go into one of your jars and > then you'd use the standard Java resource location > mechanisms (e.g. > Thread.currentThread().getContextClassLoader().getReso > urce(imageName)). That's what I'm doing and the code > runs fine standalone or via Java Webstart. > > Neil
|
|
|
|
|
|
|
|
Re: Can my application know the location of the jnlp file that launched it?
Posted:
Aug 11, 2006 1:56 PM
in response to: anilp1
|
|
|
The solution was simple and straightforward! I realized that the jnlp is in folder System.getProperty("user.dir") because that's where the user just clicked! So now the argument can be relative and resolved in the application with these two pieces base+arg. thanks, Anil Philip for good news go to http://members.tripod.com/~goodnewsforyou/
|
|
|
|
|
|
|
|
Re: Can my application know the location of the jnlp file that launched it?
Posted:
Aug 18, 2006 10:52 AM
in response to: anilp1
|
|
|
I celebrated too soon :( The user is not likely to directly click on the jnlp file. He will click on a hyperlink in an html page. So the "user.dir" will NOT contain the location of the jnlp file. Really, the Java team should be listening to this. This is an important opportunity - if you allow jnlp files to behave like html files do. All it would take is allow javaws to take a second argument - the location of the jnlp file whose url that the user clicked. After all, in Internet Explorer, when I mouseover the hyperlink in the HTML page, on the bar at the bottom of the window, I can see the correct resolved url location of the jnlp file. thanks, Anil Philip
|
|
|
|
|