| | |
| | | |
| | | import java.io.File; |
| | | import java.net.URL; |
| | | import java.net.URLDecoder; |
| | | |
| | | public class PathUtil { |
| | | /** |
| | |
| | | URL url = PathUtil.class.getProtectionDomain().getCodeSource().getLocation(); |
| | | String filePath = null; |
| | | try { |
| | | filePath = java.net.URLDecoder.decode(url.getPath(), "utf-8"); |
| | | filePath = URLDecoder.decode(url.getPath(), "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | File file = new File(realPath); |
| | | realPath = file.getAbsolutePath();//去掉了最前面的斜杠/ |
| | | try { |
| | | realPath = java.net.URLDecoder.decode(realPath, "utf-8"); |
| | | realPath = URLDecoder.decode(realPath, "utf-8"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |