Reputation: 3662
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.
Upvotes: 4
Views: 1518
Reputation: 136062
ClassLoader.getResource returns the first URL it found. Try getResources() it will search on all available classpathes
Upvotes: 5