Java tutorial
/* <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>Application Configuration</comment> <entry key="data.folder">D:\Data</entry> <entry key="jdbc.url">jdbc:mysql://localhost/mydb</entry> </properties> */ import java.io.FileInputStream; import java.util.Properties; public class Main { public static void main(String[] args) { Properties properties = new Properties(); String dataFolder = properties.getProperty("data.folder"); System.out.println("dataFolder = " + dataFolder); String jdbcUrl = properties.getProperty("jdbc.url"); System.out.println("jdbcUrl = " + jdbcUrl); } public Properties readProperties() throws Exception { Properties properties = new Properties(); FileInputStream fis = new FileInputStream("configuration.xml"); properties.loadFromXML(fis); return properties; } }