Deploying with JWS Where to put locally created files?

  • Thread starter Lionel van den Berg
  • Start date
L

Lionel van den Berg

I'm looking at using JWS to deploy an app that I previously created a
traditional installer for.

My first thoughts were that I wanted to install all the files and
directories in the apps own install directory but then I discovered that
is not the way JWS works. That seems ok, but what about files that I
want to create on the local computer like logs. At the moment the
working directory appears to be the Desktop!!!! So I make crap appear on
the desktop!

I could easily choose a directory like .myapp in /home/lionel or in
C:\Documents and Settings\lionel\Application Data\MyApp but that
requires OS specific information.

Is there some way I can get an appropriate directory in a cross-platform
manner? I want this to be a sensible directory so that the user can find
it fairly easily if I need them to.

I'm also disappointed to discover that desktop shortcuts are not
supported for any OS other than windows!

Thanks

Lionel.
 
A

Andrew Thompson

Lionel said:
I'm looking at using JWS to deploy an app that I previously created a
traditional installer for. ...
Is there some way I can get an appropriate directory in a cross-platform
manner? I want this to be a sensible directory so that the user can find
it fairly easily if I need them to.

class SomePoperties {
public static void main(String[] args) {
System.out.println( System.getProperty("java.io.tmpdir") );
System.out.println( System.getProperty("user.home") );
}
}

If using user.home, it would be best to put the
application specific data in a sub-directory based
on the main class package name, to help avoid
overwriting data from any other app.!

For a sandboxed web start app., you might look to
storing information using the PersistenceService*,
and if the user wants access to it, export it using the
FileSaveService**, to whereever the user desires.

* <http://www.physci.org/jws/#ps>
** <http://www.physci.org/jws/#fs>
 
S

Stefan Ram

Lionel van den Berg said:
Is there some way I can get an appropriate directory in a cross-platform

If you want to find a generalization of the user's home
directory:

The call »java.lang.System.getProperty( "user.home" )« does
not always deliver what the name »user.home« promises
(to make a long story short).

I did some investigations recently and found that the best
portable way to get the user's home directory might be:

http://download.java.net/jdk7/docs/...ser/FileSystemView.html#getDefaultDirectory()

You also might have a look at the other directory paths
given as system properties.
 
L

Lionel van den Berg

Andrew said:
Lionel said:
I'm looking at using JWS to deploy an app that I previously created a
traditional installer for. ..
Is there some way I can get an appropriate directory in a cross-platform
manner? I want this to be a sensible directory so that the user can find
it fairly easily if I need them to.

class SomePoperties {
public static void main(String[] args) {
System.out.println( System.getProperty("java.io.tmpdir") );
System.out.println( System.getProperty("user.home") );
}
}

If using user.home, it would be best to put the
application specific data in a sub-directory based
on the main class package name, to help avoid
overwriting data from any other app.!

For a sandboxed web start app., you might look to
storing information using the PersistenceService*,
and if the user wants access to it, export it using the
FileSaveService**, to whereever the user desires.

* <http://www.physci.org/jws/#ps>
** <http://www.physci.org/jws/#fs>

It is a sandbox app so I'll look into your suggestions. Thanks.

Lionel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top