relative document loading in classpath
import java.io.IOException; import java.net.URL; public class Main { public static void main(String[] args) throws IOException { // relative document URL url = Main.class.getResource("docs/bar.txt"); } }