In a unit test, I'm trying to get a list of classes under a package.
When I do
...getClassLoader().getResource("<some package in both main and test>");
from a unit test, it returns a URL that points to test-classes
. How do I get the URL to the main classes?
EDIT:
To be clearer, I am after a classloader that gives me access to the main classes. Ultimately, to get the right URL.
ClassLoader.getResource returns the first URL it found. Try getResources() it will search on all available classpathes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With