code: public static String getPackageResource(Class<?> type, String resourceName)
    {
      StringBuilder builder = new StringBuilder();
      builder.append(type.getPackage().getName().replace('.', '/'));
      if(resourceName.charAt(0) != '/') {
        builder.append('/');
      }
      builder.append(resourceName);
      return builder.toString();
    }
docs: Get resource name qualified with the package of a given class. Given a resource with simple name
  <code>pdf-view-fop.xconf</code> and class <code>js.fop.PdfView</code> this method returns
  <code>js/fop/pdf-view-fop.xconf</code>.
  
  @param type class to infer package on which resource reside,
  @param resourceName simple resource name.
  @return qualified resource name.