Storing state with web start/jnlp

I have a few java applets i’ve converted to web start. The only thing that’s stopping me at the moment is how to store the applications state on a given computer. I don’t want any special permissions. I just want to store a string that’s approx 200 char long. Is there an easy way and can anyone point me to a simple example?

Many thanks.

Mike

PS I believe it can be done with cookies in the sandbox but I simply didn’t understand anything that I found ???

Look into Java Muffins.

Thanks for the suggestion. I’ll look into using these.

Who names these things?

They’re named after cookies, and in that case, we do know who: Lou Montulli, the engineer at Netscape, who named them after X11’s “MIT-MAGIC-COOKIE” auth token. Where the X11 folks got it from, who knows – the phrase has been around a lot longer than X11 has. If X had come out of the UK, I suppose we’d be calling them “magic biscuits” instead.

I must admit I got stuck on the first hurdle using muffins (the persistence service). The examples state "import javax.jnlp.*; " but that immediately raises a not found error. I found out elsewhere that it’s included somewhere in the source but it gave no clear example of how to actually use it.

I’ll admit I’d prefer it if they had a simple class I could import that simply allowed you to get or store name value pairs for your given URL. I’m currently writing things back to the server but it’s a PITA :slight_smile: I guess these developers spend more time coming up with a cute name (and never a name you could hope to guess in google) than provide a simple interface that numb-skulls like me can use.

Mike

You need to add the javaws.jar to the classpath to be able to use such classes in an IDE (its automatically added when using Java Web Start). The jar can be found in the lib folder of the jre directory.

You wouldn’t have a simple example of how to do this would you?
I’ve only ever built my stuff using standard classes.

… pretty please

Right click your project -> Build Path -> Configure Build Path -> “Libraries” tab -> Add External JARs… -> Go to your java installation folder and find “javaws.jar” in the “lib” folder -> Ok :slight_smile:

Ahhh - I suspect you live in the modern world. Where I live, I have vi to edit the files and compile in the command window (XP) using :

> javac diamond_v55.java
> jar -cfm diamond_v55.jar Manifest.txt *.class *.png *.wav *.ico
> java -jar diamond_v55.jar

Is there anything I can do using these sort of commands?

Mike


javac -cp …
java -cp …


just put the path to the jar there! :)