StringBuffer buf = new StringBuffer();
//得到jar包的绝对路径
path = BasicViewer.class.getProtectionDomain().getCodeSource().getLocation().toString();
//对所得到的路径进行处理
String[] paths = path.split("/");
for(int i = 0; i < paths.length; i++){
if((i + 1) == paths.length){
break;
}else{
if(i != 0){
buf.append(paths[i]);
buf.append("/");
}
}
}
path = buf.toString(); //jar打包的绝对路径,用此路径是产生jar打包后的路径