首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

获取应用根目录有空格的有关问题

2012-07-25 
获取应用根目录有空格的问题rootthis.getClass().getClassLoader().getResource(../../WEB-INF).getPat

获取应用根目录有空格的问题

root=this.getClass().getClassLoader().getResource("../../WEB-INF").getPath();

root=/D:/Program%20Files/server/webapps/study/WEB-INF/

在程序中获取到应用的根目录时,如果server存放的目录中带有空格的解决办法:

方法1.把目录中的空格去掉。。。。

方法2:root = URLDecoder.decode(this.getClass().getClassLoader().getResource("../../WEB-INF").getPath(), "utf-8");

热点排行