StringBuffer buf = new StringBuffer();
//得到j(luò)ar包的絕對路徑
path = BasicViewer.class.getProtectionDomain().getCodeSource().getLocation().toString();
//對所得到的路徑進(jìn)行處理
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打包的絕對路徑,用此路徑是產(chǎn)生jar打包后的路徑
//得到j(luò)ar包的絕對路徑
path = BasicViewer.class.getProtectionDomain().getCodeSource().getLocation().toString();
//對所得到的路徑進(jìn)行處理
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打包的絕對路徑,用此路徑是產(chǎn)生jar打包后的路徑