81,122
社区成员




request.getSession().getServletContext().getRealPath("/") + "/upload"
public class TestCode {
public static void main(String[] args) {
String classpath = TestCode.class.getResource("/").getPath();
String projectPath = new File(classpath).getParentFile().getParentFile().getAbsolutePath();
System.out.println("classpath = " + classpath);
System.out.println("项目根目录 = " + projectPath);
}
}
classpath = /D:/app/project/muddy/test/WebRoot/WEB-INF/classes/
项目根目录 = D:\app\project\muddy\test\WebRoot