测试只在windows底下,基于Linux没测试..
private String getContextPath(){
String contextPath = this.getClass().getResource("/").toString().replace("/", "\\\\");
contextPath = contextPath.substring(contextPath.indexOf("\\")+2,contextPath.length());
return contextPath;
}