This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes File access standards Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "File access standards" Watch "File access standards" New topic

File access standards

Paul Keohan
Ranch Hand

Joined: Mar 15, 2000
Posts: 411
Something I've been wondering about for a while. If I'm trying to access a properties file I'll include it's path in my code. But ideally, it's nice to have a properties file that stores the path location of other files. Where will it stop? What can I do so I don't have to hardcode any path into my software? Is there a standard location where the jvm looks for files if there's no specific path provided?
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Not really. You can write your app to whatever default you want. What I would typically do is offer a command-line option so the user can specify a props file when starting the app:
java MyClass -p C:\Java\misc\foo\bar\
If the user doesn't specify a props file, you can specify a default behavior, such as looking for a file called in the current directory, or in the user's home directory (System.getProperty("user.home")). If no such file is found, maybe bring up a dialog asking the user "hey, where's the damn props file?" or some such (with a "create new configuration" option that leads to a new configuration wizard). Lots of choices, depending how user-friendly you want the whole thing to be, and how much time you want to put into it.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: File access standards