/*
* PropertyExample.java
* 2002/01/19
*/
import java.io.*;
import java.util.*;
public class PropertyExample {
public static void main(String[] args){
try {
String propertyFile = "/usr/app1" +
System.getProperty("file.separator") + "sample.properties";
Properties p = new Properties();
FileInputStream fis = new FileInputStream(propertyFile);
p.load(fis);
fis.close();
String hostName = p.getProperty("server.hostname");
String port = p.getProperty("server.port");
System.out.println("hostName=[" + hostName + "]");
System.out.println("port=[" + port + "]");
} catch(IOException ex){
ex.printStackTrace();
System.err.println("Ootto! caught exception...");
}
}
}
|