|
|
打包后的java文件已经在jar包里面,如何获取路径信息呢?
String path = null;String jarPath = MyDataSource.class.getProtectionDomain() .getCodeSource().getLocation().getPath();try {path = URLDecoder.decode(jarPath, "UTF-8").replaceAll("client.jar", "").replaceAll("%20", " ");} catch (UnsupportedEncodingException e) {log.error(e.getMessage());}log.info("path is:"+path);
client.jar为打包的jar名 |
|