how to get URL using relative path
new URL(url, relativePath);
If you want to build an URL pointing to a relative file, you can use:
URL url = new URL(new URL("file:"), "./myLocalFile.txt");
new URL(url, relativePath);
If you want to build an URL pointing to a relative file, you can use:
URL url = new URL(new URL("file:"), "./myLocalFile.txt");