URL s = LUtil.class.getResource("");
StringBuilder dir = new StringBuilder();
String st = s.toString();
int num = st.indexOf("classes");
// 截取classes之前和file:之后的路径(file:~~~~~~~~/classes)
StringBuilder dir = new StringBuilder();
String st = s.toString();
int num = st.indexOf("classes");
// 截取classes之前和file:之后的路径(file:~~~~~~~~/classes)
String str = st.substring(6, num + "classes".length());
用着几行代码就可以 然后 后面可以继续拼接你所需要的文件的路径即可