java中获取项目下文件资源

		String x = test.class.getClassLoader().getResource("c1.lic").toExternalForm();
        System.out.println(x);
        System.out.println(ResourceUtils.getFile(x));

结果

file:/D:/Word/workspace/C1-Consolidate/C1-Consolidate/target/classes/c1.lic
D:\Word\workspace\C1-Consolidate\C1-Consolidate\target\classes\c1.lic

你可能感兴趣的:(java)