How can I get list of all available classes in CLASSPATH at runtime?
In Eclipse IDE, you can do this by pressing Ctrl+Shift+T.
Is there any method in Java to get it done?
How can I get list of all available classes in CLASSPATH at runtime? In
Share
You can get all classpath roots by passing an empty
StringintoClassLoader#getResources().You can construct a
Filebased onURLas follows:You can use
File#listFiles()to get a list of all files in the given directory:You can use the standard
java.io.Filemethods to check if it’s a directory and/or to grab the filename.Depending on the sole functional requirement, I guess that the Reflections library is much more exactly what you want.