Java Properties File Processing

Java properties file (with extention .properties) is normally used to store the configurable parameters or strings for Internationalization and localization. In the file, each parameter is stored as a key/value pair of strings.

The post will demo how to read / write the properties file.

Read from a properties file

Here is the sample properties file content:

Code:

Output:

If the file and class is in the same package, you can use

or if they are in different packages

Write a properties file

Generated content

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on RedditShare on StumbleUponEmail this to someoneShare on TumblrDigg this

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">