This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Kubernetes in Action and have Marko Luksa on-line!
See this thread for details.
Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Delivering configuration files to client  RSS feed

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to deliver configuration files to the client applications via jnlp. I know I have to sign the jars and also think that I need to extract the files from the jars via a classloader. Does anyone have an example of how to accomplish this? I am not sure how to extract and write the files to the clients file system.

Thank You
 
Sheriff
Posts: 22968
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The usual way to get a resource (such as a configuration file) from one of the jars in an application's classpath is via the getResourceAsStream method of any of the classes in the application. Like this:

(The slash at the beginning of the URL says "Get the resource from the root of a classpath entry", but if the resource is in the same directory as the class in which this code is located, you can leave it off, making the URL relative to the class.)

I assume this should work just as well for a Web Start application as for any other application.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!