File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JNLP and Web Start and the fly likes JWS and setup/configuration files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "JWS and setup/configuration files" Watch "JWS and setup/configuration files" New topic

JWS and setup/configuration files

Steffen Foldager
Ranch Hand

Joined: Mar 22, 2001
Posts: 58
Hi all.
When making a JWS launched application, what do you do with external files for setup/configuration etc. I want to read, write and create arbitrary files on the file system which implies I use signed jars. (Out of the sandbox). Initially I can put my files in a jar, but I can't modify them or create new files.
The application is "installed" in some JWS cache directory. Is there any way to get this install dir from the Application Laucher? Is this where I put the files? Should I put the files somewhere else, possibly determined by user interaction?
How should I attack this problem?
[ January 31, 2003: Message edited by: Steffen Foldager ]

Steffen Foldager<p>Sun Certified Java Programmer<br />Sun Certified Web Component Developer
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
any files in the jar files downloaded by java web start are in the classpath. you can use the class loader to load configuration files and copy them to the user directory for example.
Steffen Foldager
Ranch Hand

Joined: Mar 22, 2001
Posts: 58
Thanks, Chantal
It makes sense. During the first run of the app I could copy the files from the jar to user.dir ("C:\Programme\Java Web Start" on my machine) in some subfolder like this:
C:\Programme\Java Web Start\myApp\config\myConfig1.xml
C:\Programme\Java Web Start\myApp\users\myUser1.xml
(At ( they suggest user.home instead of user.dir, but it makes little difference whether it's one or the other.)
These files will remain in the filesystem if the user "uninstalls" the app through JWS Application Manager. I don't think you can specify an uninstall class in jnlp that could remove the files. But that is not a big problem either.
What is worse is that I have to keep track of all installed files whenever I do an update of the jars so I don't mess up the config folder with old versions.
This implies some sort of update manager that is being run every time the application starts. The advantage with JWS being that the jars are always the latest version and the update manager should only consider files external to the jars.
Of course there are alway muffins if you can live with max. 128k config files.
I agree. Here's the link:
subject: JWS and setup/configuration files
It's not a secret anymore!