j2ee web获取路径

String prefix = getServletContext().getRealPath("/");
String file = getInitParameter("log4j-init-file");
prefix is D:\apache-tomcat-6.0.18\webapps\RenRenBrushWeb\
prefix is D:\apache-tomcat-6.0.18\webapps\RenRenBrushWeb\

你可能感兴趣的:(J2EE)