- getPath()
String path = clazz.getResource("").getPath();
- getRootClassPath()
String path = PathKit.class.getClassLoader().getResource("").toURI().getPath();
- getWebRootPath()
String path = Class .class.getResource("/").toURI().getPath();
- 輸出結果分別是
E:\workspace\jfinal_demo\out\artifacts\jfinal_war_exploded\WEB-INF\classes\com\jfinal\kit
E:\workspace\jfinal_demo\out\artifacts\jfinal_war_exploded\WEB-INF\classes
E:\workspace\jfinal_demo\out\artifacts\jfinal_war_exploded