try {
private Properties prop = new Properties();
FileReader fr = new FileReader("conf" + File.separator + "config.properties");
BufferedReader br = new BufferedReader(fr);
prop.load(br);
br.close();
} catch (FileNotFoundException e) {
new Alert(Alert.AlertType.NONE, "未找到配置文件config.properties", new ButtonType[]{ButtonType.CLOSE}).show();
} catch (Exception e) {
e.printStackTrace();
}
建议用下边这个
String conf = System.getProperty("user.home") + File.separator + "conf.properties";
FileInputStream fis = new FileInputStream(conf);
prop.load(fis);
fis.close();