java獲取路徑時,里面有空格問題:
TestReadJson ts = new TestReadJson();
// 獲得當前項目路徑
String pathPRo = ts.getClass().getResource(".").getFile().toString();
String path = pathPro+"isa_addr.json"; // 獲取文件路徑
try { path = URLDecoder.decode(path, "UTF-8"); // 通過轉碼去掉項目路徑中的空格 System.out.println(path); } catch (UnsupportedEncodingException e1) { System.out.println("路徑轉碼失敗"); }
新聞熱點
疑難解答