Accessing and encoding of properties files

Posted by NoozNooz42 on Stack Overflow See other posts from Stack Overflow or by NoozNooz42
Published on 2010-12-21T22:50:46Z Indexed on 2010/12/21 22:54 UTC
Read the original article Hit count: 165

Filed under:
|

I'm used to work with properties files, for example from Ant. Where I can simply reference the property file doing something like that:

<property file="webapp_DO_NOT_COMMIT.properties"/>

(the file is so named because our DVCS is configured as to never commit files containing "DO_NOT_COMMIT" to prevent committing credentials/passwords/etc.)

Here's a very simple .properties file example:

passwd=brokencleartextpassword

Now I want to put some configuration in another, similar, properties file that I need to access from my Java code. How should I go about it?

I also have another related question: is the character encoding of .properties file defined by any spec?

© Stack Overflow or respective owner

Related posts about java

Related posts about properties