@Test public void testIsClassLoaded() throws Exception { ClassLoader testClassLoader = new URLClassLoader(new URL[] {}); String className = "org.hotswap.agent.testData.SimplePlugin"; assertFalse("Class not loaded", ClassLoaderHelper.isClassLoaded(testClassLoader, className)); Class.forName(className, true, testClassLoader); assertTrue("Class loaded", ClassLoaderHelper.isClassLoaded(testClassLoader, className)); }
public static boolean isClassLoaded(ClassLoader classLoader, String className) { try { return findLoadedClass.invoke(classLoader, className) != null; } catch (Exception e) { LOGGER.error("Unable to invoke findLoadedClass on classLoader {}, className {}", e, classLoader, className); return false; } }
ClassLoaderHelper { public static boolean isClassLoaded(ClassLoader classLoader, String className) { try { return findLoadedClass.invoke(classLoader, className) != null; } catch (Exception e) { LOGGER.error("Unable to invoke findLoadedClass on classLoader {}, className {}", e, classLoader, className); return false; } } }
ClassLoaderHelper { public static boolean isClassLoaded(ClassLoader classLoader, String className) { try { return findLoadedClass.invoke(classLoader, className) != null; } catch (Exception e) { LOGGER.error("Unable to invoke findLoadedClass on classLoader {}, className {}", e, classLoader, className); return false; } }  }
ClassLoaderHelper { public static boolean isClassLoaded(ClassLoader classLoader, String className) { try { return findLoadedClass.invoke(classLoader, className) != null; } catch (Exception e) { LOGGER.error("Unable to invoke findLoadedClass on classLoader {}, className {}", e, classLoader, className); return false; } }  static boolean isClassLoaded(ClassLoader classLoader, String className); static boolean isClassLoderStarted(ClassLoader classLoader); }
ClassLoaderHelper { public static boolean isClassLoaded(ClassLoader classLoader, String className) { try { return findLoadedClass.invoke(classLoader, className) != null; } catch (Exception e) { LOGGER.error("Unable to invoke findLoadedClass on classLoader {}, className {}", e, classLoader, className); return false; } }  static boolean isClassLoaded(ClassLoader classLoader, String className); static boolean isClassLoderStarted(ClassLoader classLoader); static Method findLoadedClass; }