aspose file tools*
The moose likes Java in General and the fly likes Confused (JWS) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Confused (JWS)" Watch "Confused (JWS)" New topic
Author

Confused (JWS)

Lars Christian Hansen
Greenhorn

Joined: May 05, 2005
Posts: 9
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

Joined: Jul 08, 2003
Posts: 24187
    
  34

Put the configuration files inside the jar, and open them with Class.getResourceAsStream(). This is a common technique that works well.


[Jess in Action][AskingGoodQuestions]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

I found another thread in this forum where you asked the same question; I've deleted it.
Lars Christian Hansen
Greenhorn

Joined: May 05, 2005
Posts: 9
Thanks Ernest -- it worked!
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
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


Java API Documentation
The Java Tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Confused (JWS)