q909612555
2017-05-03 09:27:40
java获取项目绝对路径
public static void main(String[] args) { //获取是项目的绝对路径 System.out.println(System.getProperty("user.dir")); System.out.println(new File("").getAbsolutePath()); //获取到clsspath绝对路径 System.out.println(ServerDemo.class.getResource("/")); System.out.println(Thread.currentThread().getContextClassLoader().getResource("")); System.out.println(ServerDemo.class.getClassLoader().getResource("")); }
猜你喜欢
请下载代码后再发表评论

