//eclipse部署工程
        String path = request.getServletContext().getRealPath(
                File.separator+ "WEB-INF" + File.separator
            + "platform"+ File.separator
            +"configuration"+ File.separator
            +"services");
        //tomcat部署工程
        if(path==null){
            String tomcatBinPath = System.getProperty("user.dir");
            String tomcatRootPath = tomcatBinPath.substring(0, tomcatBinPath.lastIndexOf(File.separator));
            path = tomcatRootPath+File.separator+"webapps"+File.separator+"jointos"+File.separator+ "WEB-INF" + File.separator + "platform"+ File.separator
            +"configuration"+ File.separator+"services";
        }

以上方式可以获取到java项目部署后的路径中找到特定目录下的特定文件

相关文章:

  • 2021-11-30
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
猜你喜欢
  • 2022-02-07
  • 2021-11-18
  • 2022-02-07
  • 2021-12-08
  • 2021-08-07
  • 2022-12-23
  • 2021-11-13
相关资源
相似解决方案