• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Property Files

 
Dale DeMott
Ranch Hand
Posts: 515
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So when working with property files, where do I need to put the property files for the system to find them. And what do I need to name them. Currently I have the properties file named
AFSLLC.properties and when I look for it I put in the following code... (it can't find it right now)

Not sure why its not finding it. Can anyone shed some light on this to why this can't be found. I'm calling the method with

it can't find 'afsllc.properties'.
Thanks in advance!
-Dale

------------------
By failing to prepare, you are preparing to fail.
Benjamin Franklin (1706 - 1790)
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried it without the .properties suffix?
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
Dale DeMott
Ranch Hand
Posts: 515
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I have. That is what this line does...
System.out.println(testUtil.loadPropertiesFile("afsllc", "test"));
The file I'm looking for is afsllc.properties
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whatever file name you give the properties file, that's the name you need to pass to the Properties load() method - including the suffix. I don't know what your loadPropertiesFile() method does, but it needs to append the suffix ".properties" suffix to "afsllc" in order to function as you seem to desire. Additionally you may have a problem with not knowing what directory your program is running from - I suggest you put in a call to
<pre>
System.out.println(new File("afsllc.properties").getAbsolutePath());
</pre>
just before you call the Properties load() method, to see what exactly it's looking for.
 
David Weitzman
Ranch Hand
Posts: 1365
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure you want to be using a resoure bundle? Do you plan to have many translations of you program? It might be easier and more predictable to load the properties file more directly.
 
Dale DeMott
Ranch Hand
Posts: 515
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please explain more. What do you mean more directly.
------------------
By failing to prepare, you are preparing to fail.
Benjamin Franklin (1706 - 1790)
 
David Weitzman
Ranch Hand
Posts: 1365
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ResourceBundles' claim to faim is that they allow you to specify different properties depending on the Locale of the executing virtual machine. You can create global.properties (if property is not found anywhere else) and global_en.properties (specifically for english speakers) and global_en_US.properties (overrides some english/global stuff for united statesians) and global_fr.properties (for french people), etc. If you don't need this, then you might as well just call Properties.load(FileInputStream).
[This message has been edited by David Garland (edited August 21, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic