FAQ

This is a compilation of common usage doubts, tips and workarounds.

How can I find the resources of the current folder?

Simlpy pass "" to the ResourceUtils.getPackageResources(String) method. The method will get the resources associated to the path from where the app is being executed.

Here's an example:

 ...

  try {
   Enumeration<URL> resources = ResourceUtils.getPackageResources("");
    // more code here                     
  } catch (ResourceNotFoundException resourceNotFoundException) {
            // Exception-handling code...
  }
  
...

How can I instantiate an object from a nullary (zero-argument) constructor, ie default constructor?

Declare a null array of Class objects and pass it to the instantiateObjectFromClass(Constructor<T>, Object[]) method.

See the topic on instantiation from constructors on the Reflection Utilites user guide section for a detailed code example.

The library can't find any subfolders of a folder which has subfolders. What can I do?

The first thing to do is to check if the folder name contains any punctuation or symbolic characters or spaces. The library methods that deal with folders have been found to misbehave with this kind of names. The only workaround is to eliminate such characters from the folder name. Example:

C:\a[v]ery(o)dd{f}older name\subfolder

The 'subfolder' will not be found by the library. But all will work correctly if you change the folder name to:

C:\averyoddfoldername\subfolder