我在讀值從屬性文件如下:請與名稱的目錄保存在一個字符串
public class Backup {
public static void main(String[] args) {
Properties prop = new Properties();
try{
//load properties file for reading
prop.load(new FileInputStream("src/com/db_backup/db-backup_config.properties"));
String password = prop.getProperty("db.password");
String port = prop.getProperty("db.port");
String name = prop.getProperty("db.name");
String userid = prop.getProperty("db.userid");
String tables = prop.getProperty("db.tables");
String host = prop.getProperty("db.host");
} catch (IOException ex) {
ex.printStackTrace();
}
System.out.println();
}
}
我想使存儲在字符串用戶ID名稱的目錄。我怎麼能這樣做?這也是閱讀屬性文件的最佳方式嗎?
我設法找出目錄,但仍然不確定屬性。謝謝! – idaWHALE