• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Java Web Start - Deploy application including required folders and files

 
Greenhorn
Posts: 20
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Bartender
Posts: 1385
39
IBM DB2 Netbeans IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Arnold Gatmaitan
Greenhorn
Posts: 20
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 28394
100
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Arnold Gatmaitan
Greenhorn
Posts: 20
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 28394
100
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, that works too. Perhaps even simpler than my process.
 
Claude Moore
Bartender
Posts: 1385
39
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic