0
我創建了一個屬性文件並存儲在根文件夾中。 (Java的Web項目,小服務程序)java web應用程序 - 屬性文件加載說明
代碼:
Properties prop = new Properties();
try {
prop.setProperty("EPU", "A1,A2,A3,A4,A8,A9,B1,B2,B3,B8,B9");
//save properties to project root folder
prop.store(new FileOutputStream("dbsc.properties"), null);
} catch (IOException ex) {
}
,並在下面的路徑
Project ->Project Name ->dbsc.properties
的話,我想讀(負載)這個屬性文件成功創建屬性文件,代碼低於
prop.load(new FileInputStream("dbsc.properties"));
當我執行收到一個FileNotFoundException
java.io.FileNotFoundException: kindcode.properties (The system cannot find the file specified)
我的問題:
它是正確的步驟和路徑保存屬性文件?
我該如何加載屬性文件?