Reading and writing properties file in Java is little different than reading or writing text file in Java or reading xml files in Java using xml parsers like DOM because Java provides special provision to properties file. For those who are not familiar with Properties file in java, It is used to represent configuration values like JDBC connectivity parameter or user preferences settings and has been a primary source of injecting configuration on Java application. Properties file in Java is a text file which stores data in form of key and value, key being known as property. Java allows you to read value of property by providing its name which makes it easy to access configuration settings. Two popular example of properties file are jdbc.properties often used to store database connection settings like URL, username and password and log4j.properties file which settings for java logging using log4j. There are also many frameworks which uses Java properties file like Struts, Spring, Displaytag etc. Another advantage of using properties file is that you can represent data either in xml format or in properties format. xml format will be particularly useful if you are sharing configuration or settings with some external tool which understands only xml. In this article we will see how to read and write into Properties file in Java on both xml and text format.
Read more »
Selasa, 06 Maret 2012
core java
0 Response to "How to read Properties File in Java – XML and Text Example Tutorial"
Posting Komentar