獲取src下的fileurl.properties文件路徑
this.getClass().getResource("/fileurl.properties").getPath()
【this.getClass().getResourceAsStream("/"+Basic.dll);】----jar中的class獲取jar內部的資源文件,該文件打包成jar前放置在src目錄下
如果文件和讀取類在同一個包下,把“/”去掉【this.getClass().getResourceAsStream(Basic.dll);】
獲取webRoot下的service文件夾路徑
request.getSession().getServletContext().getRealPath("/service");
解決路徑中包含空格
URLDecoder.decode(this.getClass().getResource("/fileurl.properties").getPath(),"utf-8")
獲取jar同級目錄下的文件:例如System.getProperty("user.dir")+java.io.File.separator+“文件名”