Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confused (JWS)

 
Lars Christian Hansen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My app (jar file) uses two configuration files. When excuting the jar file locally in a dir where both the conf. files reside - no problem. App runs fine. But...

When I upload to my website, place the jar along with the two conf files in same dir, launch app (using JWS) - the conf files aren't read. I think I know why: JWS downloads the jar to some local dir and executes, which leaves the two conf files still hanging on the web site. Unreachable.

Does anybody have any input as to how I can solve this?

Thx/

Lars
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put the configuration files inside the jar, and open them with Class.getResourceAsStream(). This is a common technique that works well.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found another thread in this forum where you asked the same question; I've deleted it.
 
Lars Christian Hansen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ernest -- it worked!
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should also provide some default values for the configuration parameters. If you want to get fancy, you can provide a menu so that the user can edit these parameters via your program. In this case, you will probably just create the config files if they don't exist on the machine.

HTH

Layne
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic