1. 程式人生 > >java中獲取專案下檔案資源

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