/**
* 属性文件加载对象
*/
private static PropertiesLoader loader = new PropertiesLoader(“j.properties”);
String path= loader.getProperty(“name”);
if(path==null){
/**
*getRealPath(“/”) 获取实际路径,项目在容器中的实际发布运行的根路径。
- PS:文件分隔符(在 UNIX 系统中是“/”),window 是”\”
*Window: D:\apache-tomcat-7.0\webapps
*Linux: D:/apache-tomcat-7.0/webapps
linux下需 .path.replaceAll("/","\\\\") ;
*/
path=ServletContextFactory.getServletContext().getRealPath("/");
File file = new File(path);
String [] fileName = file.list();
File [] files = file.listFiles();
for(File a:files)
{
if(a.isDirectory())
{
}
}