wood burning stoves 2.0*
The moose likes JNLP and Web Start and the fly likes JWS and properties file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "JWS and properties file" Watch "JWS and properties file" New topic
Author

JWS and properties file

Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

Can JWS application read from a properties file? Or do I need to use persistance service APIs? My current stand-alone application reads lot of values from the properties file, so I was wondering if it would possible to let
it stay that way.
- Manish
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi Manish

Can JWS application read from a properties file?

yes. why not? i don't see any problem in doing that. i guess u r reading property files via loadProperties() or some standard java mechanism right?
u may 've to sign the application jar tho if u want to store that properties file on the user machine ....
regards
maulin
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

We don't want to sign the jar file. So I did find <property> tag of JNLP, but unfortunately it is not working either.
I did try using <property name="jnlp.xyz" value="somevalue"> and <property name="javaws.xyz" value="somevalue">, but it gives me security exception when I try to read this property. So at the moment I am reading the properties file from the server via URLConnection. Is there a better way of doing this?
TIA,
- Manish
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi Manish
i played w/ it more and i find following,
the problem is we can use property tag of the jaws only if we have signed the jar files. the reason being, property tag in JNLP is just a declaration that we want to make some "key" , "value" visible via System.getProperty() or System.getProperties(). Now, jaws will go to actually write the System property with name "key" and value "value" upon dowloading the jar file. This means that we have to have "write" permission for the property on the system which is by default not available
thus , JNLP property tag doesn't work for us unless we sign the application jar. i tried to sign in and it works. though we have to specify security tag in JNLP after signing the application as you might know already.
so, the solution u adopted seems okay. the only disadvantage u 'll have is- u won't be able to run ur application off line as it will require URLCOnnection. u can probably adapt some mechanism using JNLP Persistence API to store the properties u read in "muffins" and then use them while u r offline....
regards
maulin
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi Manish
also, i found another tweak. that is- if ur properties are really not java system properties like line.separator etc and user custom property like "userName" etc then u can use "arguments" JNLP tag and pass it to main class in the jar following a convention u define.
e.g.
if u had a property name jnlp.name and jnlp.server which u wanted to transfer to the application then u can write,

and then in main class u can interpret the arguments and prepare hashtable of the properties.
this is little more work than using System.getProperty() but it might be feasible for u...
regards
maulin
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

AFAIK, if you prepend property name with jnlp or javaws, then even an unsigned JWS application can read (only) these properties, it is also mentione on Sun site somewhere. But for some reasons, it is not working.
I have also resorted to using arguments as a woraround.
My application is a very much a client server application and uses servlets heavily to do lots of things. So reading from the server is fine.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JWS and properties file
 
Similar Threads
Is editing of client copy of jnlp file possible when using JWS?
Java and activeX ?
standard output screen
How to make Swing App Web Enabled
to view jws from an EAR