URL url =this.getClass().getClassLoader().getResource("/"+ basePackageName.replaceAll("\\.","/"));
String pathFile = url.getFile(); //如果是中文路径 pathfile是路径里面是乱码
//需要进行decode才能正常显示中文路径
String urlPath=java.net.URLDecoder.decode(pathFile,"utf-8");
参考链接 http://blog.sina.com.cn/s/blog_67cc72cc0101ejie.html
网友评论