如图所示,Java代码BannerServiceImple如何使用相对路径的方式调用另一个包下面的资源.
public String getRootPath(){
File path = null;
try {
path = new File(ResourceUtils.getURL("classpath:").getPath());
} catch (FileNotFoundException e) {
e.printStackTrace();
}
if(path==null||!path.exists()) path = new File("");
return path.getAbsolutePath();
}
这样应该就可以了