xxx.class.getClassLoader().getResource("")获取是什么路径
答
获取的是class文件的根目录路径,看以下例子:
String file = SysAdminController.class.getClassLoader().getResource("").getFile();
file值(不是运行jar包):http://www.yayihouse.com/yayishuwu/chapter/2087
注意:String file = SysAdminController.class.getClassLoader().getResource("/").getFile();//报错不能写“/”