Skip to main content

Searching the classpath

1 reply [Last post]
Joined: 2003-06-17

I would like to have an api to search for
resources on the classpath.

For instance in my application I would like to
load all plugins. Plugins are class-files that
could be loaded with the following regular
expression 'plugins/*'.

Basically I would like that
ClassLoader.getResources(String resourceName) would
allow regular expression as a resourceName.


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-10

Some types of location which are permitted on a classpath are not necessarily searchable. Instead use a single resource name and find all instances of that name in your classpath using ClassLoader.getResources. These resources should list the plugins available.

This type of mechanism is alluded to here (a section of the documentation which could be greatly improved)

Also look at RFE 4640520 on the bug parade.

Message was edited by: mthornton