File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Relational Links to .txt files (Eclipse Indigo) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Reply Bookmark "Relational Links to .txt files (Eclipse Indigo)" Watch "Relational Links to .txt files (Eclipse Indigo)" New topic
Author

Relational Links to .txt files (Eclipse Indigo)

Greg Reeder
Ranch Hand

Joined: Jun 14, 2011
Posts: 99

Hi everyone,

first off, it has been a long time since I visited the ranch, so greeetings everyone! Secondly, although this question fits IO, but at the same time might be better off in an IDE forum, I hope that it is acceptable here. My problem is this:

I am working with eclipse indigo, and I want to have a configuration text file for my program. This would be home to, among a few other things, the path to my database which my program uses. The last thing I want to do is code a final path to the database directly in my db controller class. I, at the same time, do not necessarily want to do the same thing to my config file either. Is there a way to solve this problem well? I thought about it, and would like to use a relational link to my text file. Does java itself offer a solution? How would I go about working this into eclipse indigo?

Thank you for your help!!

Greg
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 13842

The usual thing is to just put the configuration file into your classpath and use code like this:

to access it.

As for Eclipse, you just put the configuration file at the root of your source code tree. In the "src" folder if you did it that way, probably.
Greg Reeder
Ranch Hand

Joined: Jun 14, 2011
Posts: 99

Thank you, that was the key.
 
 
subject: Relational Links to .txt files (Eclipse Indigo)
 
Threads others viewed
Scanning/Storing a String that the user enters?
Eclipse palette problem
file searching with file name in a specific root directory
Writing a class file to read text file.
Q 4 Mr E.R. Harold (2): XML vs SQL
developer file tools