How to load all the jars from a directory dynamically?
Hi I am creating a plugin which requires loading jars dynamically and accessing the classes and methods of these jars. I tried using URLClassLoader and am able to load the classes as shown below URL myJarFile = new URL("jar","","file:"+jarPath); URLClassLoader sysLoader =(URLClassLoader)ClassLoader.getSystemClassLoader(); Class sysClass = URLClassLoader.class; Method sysMethod = sysClass.getDeclaredMethod("addURL", new Class[]{URL.class}); sysMethod.setAccessible(true); sysMethod.invoke(sysLoader, new Object[]{myJarFile}); But the issue with this is that we have to load classes into