• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Web Start - Deploy application including required folders and files  RSS feed

 
Alder Potenz
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I developed an application that is accessing some property files. The condition was that the user should be able to modify the content or parameters of those property file.
How can I distribute the application using Java web start that also includes those property file in the client side?

Thanks!
 
Claude Moore
Ranch Hand
Posts: 924
9
IBM DB2 Java Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I don't know if JNLP allows you to specify resources like property files to be deployed with your application: as far as I know you have to embed these resources within
a jar file and use getResource() properly within your application to extract and use required resources. The problem is that if the user needs to store some kind of information
in these property files, they should be saved safely in some position on user's workstation, somewhere external to JWS cache.
For such application, I used to store such properties in user_home directory in a folder specific for my application.
Of course, in order to allow JWS security mechanism to access local resources on any host , you need to digitally sign your application. And the user must accept
to allow full (or restricted, it depends) privileges to your application.

 
Alder Potenz
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.

But how can I achieve this solution using JAWS?
For such application, I used to store such properties in user_home directory in a folder specific for my application.


Actually the configuration is saved in an xml file when the user change it in the configuration window of the application.


I want the user be able to use the last configuration setting he set to the application.
 
Paul Clapham
Sheriff
Posts: 22844
43
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's how to do it.

Put your application in a jar file, and include the default version of the properties file.

Then when the application wants to get the properties, it should first look in the user's directory. If the file is there, it uses that. Otherwise it uses the default version from the jar.

And when the user wants to change the properties, the application should get the properties (as above) and then write the changed version out into the user's directory.
 
Alder Potenz
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for the help. What I did was include property files (properties is programmatically changing) inside the jar of the application.
Upon start up of the application the application will check if the files are in already in the user's directory. If not it will copy the property files in the users directory.

I use .getResourceAsStream() to extract the resources and put it in the users directory.

Thanks!
 
Paul Clapham
Sheriff
Posts: 22844
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that works too. Perhaps even simpler than my process.
 
Claude Moore
Ranch Hand
Posts: 924
9
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Yes, that works too. Perhaps even simpler than my process.


Well, there may be a lot of variations on the theme. If the application provided a dialog (for example) where user may set required properties, it would not be necessary to extract a precompiled property / xml file.
For example, in a project of mine when the program didn't find a property file in user's home folder, I displayed a dialog user must fill with required data at first execution of the program.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!