保存到properties

Posted 范世强的笔记(SEC-fsq)

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了保存到properties相关的知识,希望对你有一定的参考价值。

@FXML
private void savaconfig(ActionEvent event) {
try {
Properties prop = new Properties();
FileWriter fw = new FileWriter("conf" + File.separator + "config.properties");
BufferedWriter br = new BufferedWriter(fw);

String sqlmapPath = this.id_textFeild.getText();

prop.setProperty("SqlmapPath", sqlmapPath);

prop.store(br, "配置文件");

br.close();
new Alert(Alert.AlertType.NONE, "已保存到配置文件config.properties", new ButtonType[] { ButtonType.CLOSE }).show();
}
catch (Exception e) {
new Alert(Alert.AlertType.NONE, "未找到配置文件config.properties", new ButtonType[] { ButtonType.CLOSE }).show();
e.printStackTrace();
}
}

以上是关于保存到properties的主要内容,如果未能解决你的问题,请参考以下文章