Find list of classes implementing certain interface in the classpath?

How do find all classes that implement a certain interface in the classpath?
mdolandAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Radek BaranowskiFull-stack Java DeveloperCommented:
Are you in any kind of IDE ?

or is it just shell with jar/war/ear files ?

If you have source files you can just runn fulltext search against "implements InterfaceName"
0
mdolandAuthor Commented:
It is from a java-program outside any IDE and jar/war and ear-files should be searched through.
0
mccarlIT Business Systems Analyst / Software DeveloperCommented:
There is nothing built in to Java to do this.

However, there are libraries that can do what you are after. If you are already using Spring, then it has some built-in functionality using ClassPathScanningCandidateComponentProvider, check the docs out here: http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.html

Otherwise, have a look at this library: https://code.google.com/p/reflections/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.