我有一个网址:
URL url=new URL("https://example.com/aa/bb/cc/file.html");
和一个相对路径:
String relativePath="../file2.html"; //maybe is "/file3.html"
我想获取 http://example.com/aa/bb/file2.html
使用变量 url
和 relativePath
怎么做?
最佳答案
new URL(url, relativePath);
关于java - 如何使用相对路径获取 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3665484/