{"id":4050,"date":"2014-10-03T07:28:05","date_gmt":"2014-10-03T05:28:05","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/"},"modified":"2014-10-03T07:28:05","modified_gmt":"2014-10-03T05:28:05","slug":"java-get-class-names-from-package-string-in-classpath","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/","title":{"rendered":"Java get Class names from package String in classpath"},"content":{"rendered":"<p><img decoding=\"async\" class=\"blog-image aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/2e1ax_default_entry_java.jpg\" alt=\"\" \/><\/p>\n<p>As a Java developer you probably used to know about reflexion. However, in order to keep your software architecture flexible, some functionalities are sometimes not provided out of the box by the JVM.<br \/>\nIn my particular case, I needed to find out every Class and Sub-Classes inside a package, thus reparteed within several Jars.<br \/>\nInternet has lots of solution, but it remains complicated for everybody to reach this goal. After googleing, I found a link which provided a partial solution. I would like to thank the website author:<\/p>\n<p><a href=\"http:\/\/www.java2s.com\/Code\/Java\/Reflection\/Attemptstolistalltheclassesinthespecifiedpackageasdeterminedbythecontextclassloader.htm\">http:\/\/www.java2s.com\/Code\/Java\/Reflection\/Attemptstolistalltheclassesinthespecifiedpackageasdeterminedbythecontextclassloader.htm<\/a><\/p>\n<p>Some other solution invited us to deploy external libraries as well. But I was not interested to manage another lib in my soft just for that purpose.<br \/>\nSo, the solution was to recover all jars from the context classloader and loop on them in order to find out the classes we are looking for.<br \/>\nFollowing, you will see a complete Java class resolving this issue:<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">import java.io.File;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">import java.io.IOException;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">import java.io.UnsupportedEncodingException;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">import java.net.URL;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">import java.net.URLClassLoader;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">import java.net.URLDecoder;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">import java.util.ArrayList;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">import java.util.Enumeration;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">import java.util.HashMap;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">import java.util.List;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">import java.util.jar.JarEntry;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">import java.util.jar.JarFile;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\/**<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0*<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0*<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0*<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0* @author Philippe Schweitzer dbi services Switzerland<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0*<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0*\/<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">public class ClassFinder {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 public static void main(String[] args) throws ClassNotFoundException {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 List&lt;Class&gt; classes = ClassFinder.getClassesFromPackage(&#8220;YOUR PACKAGE NAME&#8221;);<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 System.out.println(&#8220;START ClassList:&#8221;);<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 for (Class c : classes) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 System.out.println(c.toString());\/\/ + &#8221; &#8221; + c.getCanonicalName());<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 System.out.println(&#8220;END ClassList:&#8221;);<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \/**<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0*<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0* Attempts to list all the classes in the specified package as determined \u00a0 \u00a0 *<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0* by the context class loader&#8230;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0*<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0* @param pckgname the package name to search<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0* @return a list of classes that exist within that package<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0* @throws ClassNotFoundException if something went wrong<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0*<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0*\/<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 public static List getClassesFromPackage(String pckgname) throws ClassNotFoundException {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 ArrayList result = new ArrayList();<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 ArrayList&lt;File&gt; directories = new ArrayList();<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 HashMap packageNames = null;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 try {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 for (URL jarURL : ((URLClassLoader) Thread.currentThread().getContextClassLoader()).getURLs()) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 System.out.println(&#8220;JAR: &#8221; + jarURL.getPath());<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 getClassesInSamePackageFromJar(result, pckgname, jarURL.getPath());<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 String path = pckgname;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Enumeration&lt;URL&gt; resources = cld.getResources(path);<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 File directory = null;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 while (resources.hasMoreElements()) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 String path2 = resources.nextElement().getPath();<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 directory = new File(URLDecoder.decode(path2, &#8220;UTF-8&#8221;));<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 directories.add(directory);<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if (packageNames == null) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 packageNames = new HashMap();<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 packageNames.put(directory, pckgname);<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 } catch (NullPointerException x) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 throw new ClassNotFoundException(pckgname + &#8221; does not appear to be a valid package (Null pointer exception)&#8221;);<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 } catch (UnsupportedEncodingException encex) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 throw new ClassNotFoundException(pckgname + &#8221; does not appear to be a valid package (Unsupported encoding)&#8221;);<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 } catch (IOException ioex) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 throw new ClassNotFoundException(&#8220;IOException was thrown when trying to get all resources for &#8221; + pckgname);<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 for (File directory : directories) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if (directory.exists()) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 String[] files = directory.list();<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 for (String file : files) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if (file.endsWith(&#8220;.class&#8221;)) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 try {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/\/ \u00a0 \u00a0 \u00a0System.out.println(packageNames.get(directory).toString() + &#8216;.&#8217; + file.substring(0, file.length() &#8211; 6));<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result.add(Class.forName(packageNames.get(directory).toString() + &#8216;.&#8217; + file.substring(0, file.length() &#8211; 6)));<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } catch (Throwable e) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } else {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 throw new ClassNotFoundException(pckgname + &#8221; (&#8221; + directory.getPath() + &#8220;) does not appear to be a valid package&#8221;);<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 return result;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \/**<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0*<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0* Returns the list of classes in the same directories as Classes in<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0* classes.<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0*<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0* @param result<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0* @param classes<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0* @param jarPath<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0*<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0*\/<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 private static void getClassesInSamePackageFromJar(List result, String packageName, String jarPath) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 JarFile jarFile = null;<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 try {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 jarFile = new JarFile(jarPath);<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Enumeration&lt;JarEntry&gt; en = jarFile.entries();<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 while (en.hasMoreElements()) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 JarEntry entry = en.nextElement();<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 String entryName = entry.getName();<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 packageName = packageName.replace(&#8216;.&#8217;, &#8216;\/&#8217;);<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if (entryName != null &amp;&amp; entryName.endsWith(&#8220;.class&#8221;) &amp;&amp; entryName.startsWith(packageName)) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 try {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Class entryClass = Class.forName(entryName.substring(0, entryName.length() &#8211; 6).replace(&#8216;\/&#8217;, &#8216;.&#8217;));<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if (entryClass != null) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 result.add(entryClass);<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } catch (Throwable e) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\/\/ do nothing, just continue processing classes<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 } catch (Exception e) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 } finally {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 try {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if (jarFile != null) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 jarFile.close();<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } catch (Exception e) {<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">\u00a0 \u00a0 }<\/p>\n<p style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% #e6e6ff; padding: 0cm;\" align=\"LEFT\">}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As a Java developer you probably used to know about reflexion. However, in order to keep your software architecture flexible, some functionalities are sometimes not provided out of the box by the JVM. In my particular case, I needed to find out every Class and Sub-Classes inside a package, thus reparteed within several Jars. Internet [&hellip;]<\/p>\n","protected":false},"author":40,"featured_media":4051,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[497,214,498,499],"type_dbi":[],"class_list":["post-4050","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-application-integration-middleware","tag-classloader","tag-java","tag-java-class","tag-java-package"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Java get Class names from package String in classpath - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java get Class names from package String in classpath\" \/>\n<meta property=\"og:description\" content=\"As a Java developer you probably used to know about reflexion. However, in order to keep your software architecture flexible, some functionalities are sometimes not provided out of the box by the JVM. In my particular case, I needed to find out every Class and Sub-Classes inside a package, thus reparteed within several Jars. Internet [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2014-10-03T05:28:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/2e1ax_default_entry_java.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"258\" \/>\n\t<meta property=\"og:image:height\" content=\"195\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Middleware Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Middleware Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/\"},\"author\":{\"name\":\"Middleware Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1\"},\"headline\":\"Java get Class names from package String in classpath\",\"datePublished\":\"2014-10-03T05:28:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/\"},\"wordCount\":621,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/2e1ax_default_entry_java.jpg\",\"keywords\":[\"Classloader\",\"Java\",\"Java Class\",\"Java Package\"],\"articleSection\":[\"Application integration &amp; Middleware\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/\",\"name\":\"Java get Class names from package String in classpath - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/2e1ax_default_entry_java.jpg\",\"datePublished\":\"2014-10-03T05:28:05+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#primaryimage\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/2e1ax_default_entry_java.jpg\",\"contentUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/2e1ax_default_entry_java.jpg\",\"width\":258,\"height\":195},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java get Class names from package String in classpath\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1\",\"name\":\"Middleware Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"caption\":\"Middleware Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/middleware-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Java get Class names from package String in classpath - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/","og_locale":"en_US","og_type":"article","og_title":"Java get Class names from package String in classpath","og_description":"As a Java developer you probably used to know about reflexion. However, in order to keep your software architecture flexible, some functionalities are sometimes not provided out of the box by the JVM. In my particular case, I needed to find out every Class and Sub-Classes inside a package, thus reparteed within several Jars. Internet [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/","og_site_name":"dbi Blog","article_published_time":"2014-10-03T05:28:05+00:00","og_image":[{"width":258,"height":195,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/2e1ax_default_entry_java.jpg","type":"image\/jpeg"}],"author":"Middleware Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Middleware Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/"},"author":{"name":"Middleware Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1"},"headline":"Java get Class names from package String in classpath","datePublished":"2014-10-03T05:28:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/"},"wordCount":621,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/2e1ax_default_entry_java.jpg","keywords":["Classloader","Java","Java Class","Java Package"],"articleSection":["Application integration &amp; Middleware"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/","url":"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/","name":"Java get Class names from package String in classpath - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/2e1ax_default_entry_java.jpg","datePublished":"2014-10-03T05:28:05+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/2e1ax_default_entry_java.jpg","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/2e1ax_default_entry_java.jpg","width":258,"height":195},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/java-get-class-names-from-package-string-in-classpath\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Java get Class names from package String in classpath"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1","name":"Middleware Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","caption":"Middleware Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/middleware-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/4050","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=4050"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/4050\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/4051"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=4050"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=4050"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=4050"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=4050"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}