Many thanks for your time
PS (one app is an arcade game while the other plays chess)
Mich Robinson wrote:I have a couple of web start apps that would both benefit from being able to store a string (presumably as a cookie). String is approximately 200 char. I saw some weird code that stored data as a cookie but couldn't make head nor tail of it. Is there a simple way? My apps either get called from the browser or from the desktop.
One of us is missing something. If you use a JNLP you are running on the client's machine and you can just ask for permission to write to the disk, create a file and store whatever you need there.
Now if you need to run in a tight security environment you can have the page that launches the app create a cookie and pass it as a parameter in the jnlp which your app can use to communicate with the server. I don't know of a way for a Java app to access the browser's cookie file and it's complicated because the jnlp file can be stored and launched without a browser.
If all you want to do is store a small amount of information, I would mark the jnlp as needing disk access and put a small file in the $HOME directory.
The programs I write are games (arcade games & board games). Users feel fine running a Java app because there is a minimal security risk of viruses etc. If an arcade game pops up a message saying it wants to write to your file system then a fair percentage of potential users will just not want to take the risk. It doesn't really matter that all I wanted to store were high scores and user preferences.
Joe Areeda wrote:One of us is missing something. If you use a JNLP you are running on the client's machine and you can just ask for permission to write to the disk, create a file and store whatever you need there.
I'll look into these. I did try a similar API but I just couldn't get it to work. I'll admit I seem to have a lot more issues trying to run web start applications that applets (I still can't even get the screen icon to show up on the users desktop!). I'll admit I was hoping for a simple pair of methods to call that would write and read a name/value pair (preferably as a cookie or something). Unfortunately nothing is ever as simple as you hope.
Maneesh Godbole wrote:Another option could be to consider the preference API
I agree that using these interfaces is not simple when compared to a simple java.util.Properties object or the Preferences API. It often seems easier to sign your code and ask for all-permissions the first time it is run so you can use standard persistence methods.