java获取当前resources路径

路径不要有中文,负责会报错


            String filePath1 = Objects.requireNonNull(getClass().getResource("/word/patrolLogExport.docx")).getPath();

            FileInputStream fileInputStream = new FileInputStream(filePath1);

            XWPFDocument document = new XWPFDocument(fileInputStream);

你可能感兴趣的:(java,开发语言)