java中如何获得系统路径

在Application中: 
 System.getProperty("user.dir") 
 在Servlet中: 
 ServletContext servletContext = config.getServletContext(); 
 String rootPath = servletContext.getRealPath("/"); 
 在JSP中:
 application.getRealPath("")  
 

你可能感兴趣的:(java中如何获得系统路径)