当我运行我的程序时,我得到这个错误日志:
java.io.FileNotFoundException: config.properties (Het systeem kan het opgegeven bestand niet vinden)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:97)
at Manuals.<init>(Manuals.java:62)
at Manuals.main(Manuals.java:479)
Exception in thread "main" java.lang.NullPointerException
at Manuals.getProjects(Manuals.java:372)
at Delete.<init>(Delete.java:27)
at Manuals.run(Manuals.java:90)
at Manuals.main(Manuals.java:479)
这是行,我在其中使用我的property
文件。程序正在创建文件,但无法读取或编辑它。我使用了 StackOverflow 的一些解决方案,但没有成功。这是我第一次调用Properties
类的地方:
public Manuals() throws IOException{
// Check config file for first startup
configFile = new Properties();
Properties configFile = new Properties();
try {
FileInputStream file = new FileInputStream("config.properties");
configFile.load(file);
} catch (FileNotFoundException ex) {
Logger.getLogger(Manuals.class.getName()).log(Level.SEVERE, null, ex);
}
curPdf = new ArrayList();
addPdf = new ArrayList();
allPdf = new ArrayList();
this.search = "";
}