java.io.FileNotFoundException: Source 'file:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/lib/ant-javafx.jar!/resources' does not exist为什么会报这个错1:ant-javafx.jar这个包是存在的2:jdk路径没有错3:我用的是Intellij IDEA这个是代码``URL url=TopologyMain.class.getResource("/words.txt");Config conf=new Config();conf.put("wordsFile",url.toString());
3 回答

眼眸繁星
TA贡献1873条经验 获得超9个赞
是 words.txt 找不到。可以判断文件是否存在,如果不存在就创建
在 getResource 之前执行
File f = new File("/words.txt");
if (!f.exists()) {
try {
f.createNewFile();
} catch(Exception e) {
e.printStackTrace();
}
}
添加回答
举报
0/150
提交
取消