那你就把相对路径转化成绝对路径嘛
relativeUrlPath是你要使用的相对路径
String path=getAbsolutePathRelativeToContext(relativeUrlPath)
//path就是绝对路径  然后你再把path传入new URL的构造式里