JAVA获取当前工程路径时间:2022-08-26 15:28:41(只适用于非WEB工程) File file = new File(""); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); String path = file.getAbsolutePath(); (WEB工程下得到的是tomcat下的路径)