Example #1
0
 /**
  * Gets the list of libraries that are currently loaded
  *
  * @return the list of loaded libraries.
  */
 @SuppressWarnings("unchecked")
 public static List<String> getLoadedLibraries() {
   if (g_oLibraries == null) {
     g_oLibraries = new List<String>();
     try {
       java.lang.reflect.Field loLibField =
           ClassLoader.class.getDeclaredField("loadedLibraryNames");
       loLibField.setAccessible(true);
       Vector<String> loLibraries =
           (Vector<String>) loLibField.get(Utilities.class.getClassLoader());
       for (String lcLibrary : loLibraries) {
         g_oLibraries.add(lcLibrary.replaceFirst(m_cLibRegex, "$1").toLowerCase());
       }
     } catch (NoSuchFieldException | IllegalAccessException ex) {
       // That would be a problem.
     }
   }
   return g_oLibraries;
 }
Example #2
0
 /**
  * Checks if the library specified is actually loaded. This is a case insensitive check
  *
  * @param tcLibrary the library to check.
  * @return true if the library is loaded, false otherwise
  */
 public static boolean isLibraryLoaded(String tcLibrary) {
   Utilities.checkParameterNotNull("tcLibraryName", tcLibrary);
   return g_oLibraries != null
       && g_oLibraries.contains(tcLibrary.replaceFirst(m_cLibRegex, "$1").toLowerCase());
 }