1.java工程中, 获取工程所在路径:
System.getProperty("user.dir") //user.dir指定了当前的路径
2.web工程中,获取tomcat下的项目路径:
this.getServletContext().getRealPath("/"); // 获取tomcat下项目路径
1.java工程中, 获取工程所在路径:
System.getProperty("user.dir") //user.dir指定了当前的路径
2.web工程中,获取tomcat下的项目路径:
this.getServletContext().getRealPath("/"); // 获取tomcat下项目路径