各位大侠,我在MyEclipse的src目录下的包com.liyu.read里面些了一个类
其中有一句话File file = new File(“abc.txt”);打印System.out.println(file.exists());,怎么老是false,
我已经在src目录下放了abc.txt啊,并且在包里面也放了。
请各位大侠指正。跪求!!!
其中有一句话File file = new File(“abc.txt”);打印System.out.println(file.exists());,怎么老是false,
我已经在src目录下放了abc.txt啊,并且在包里面也放了。
请各位大侠指正。跪求!!!
new File(this.getClass().getClassLoader().getResource("abc.txt").getPath())
在项目下面用“new File(./abc.txt)”