取类及项目的绝对路径

Test.class.getResource("").getPath();//取类绝对路径

Test.class.getResource("/").getPath();//项目Classes的根路径

 

你可能感兴趣的:(java)