[最近项目中需要使用获取操作系统路径问题,刚开始使用的是System.getProperty("user.dir")获取相对路径,但是这存在一个问题就是,我们使用shell脚本启动的时候, 如果启
比如页面
http://ss.sysu.edu.cn/InformationSystem/ (注意最后的 / )
http://ss.sysu.edu.cn/InformationSystem/ArticleList.aspx?id=36
里面有[ java 路径访问全接触 收藏 前言: 前一段时间,由于在处理Web应用下的文件创建与移动等,因此涉及到很多关于java中相对路径,绝对路径等问题。同时,对于Web应用中的相
如何获得该 的绝对路径呢? http://ss.sysu.edu.cn/InformationSystem/Article.aspx?id=6052
URL url = new URL("http://ss.sysu.edu.cn/InformationSystem/");
String href = "Article.aspx?id=6052";
URL url2 = new URL(url,href);
System.out.println(url2.toString())// 即可得到绝对路径
[ //绝对路径 String absolutePath = "http://www.aaa.com/1/2/3.html"; //相对路径 String relativePath = "../../a.jpg"; //以下方法对相对路径进行转换 URL ab