获取根目录



java获取程序根目录 WEB-INFO目录 CLASSES文件夹路径

System.out.println(this.getClass().getResource("/com/lavasoft/res/a.txt"));
System.out.println(this.getClass().getResource("").getPath());
System.out.println(this.getClass().getResource("/").getPath());
System.out.println(this.getClass().getClassLoader().getResource("").getPath());

猜你喜欢

转载自1971161579.iteye.com/blog/2380996
今日推荐