File structure:
\a
programme.class
programme.java
\b
text.txt
Having my current directory under \a (which means that the default classpath is set to \a as well) and having this for my code (for testing purpose):
System.out.println(programme.class.getClassLoader().getResource("b/text.txt"));
Running my programme from the folder \a doesn't require me to specify classpath for b. Hence, I can run my programme simply like this: java programme
Now, I thought that adding a directory to the classpath (in our case the default classpath is user.dir aka \a) doesn't resolve the subdirectories (doesn't add them recursively to classpath).
How does the classloader find the file b\text.txt in classpath?