Answers for "how to print package details in java"

0

how to print all package in java

final ClassLoader loader = Thread.currentThread().getContextClassLoader();

for (final ClassPath.ClassInfo info : ClassPath.from(loader).getTopLevelClasses()) {
  if (info.getName().startsWith("my.package.")) {
    final Class<?> clazz = info.load();
    // do something with your clazz
  }
}
Posted by: Guest on April-17-2021

Code answers related to "how to print package details in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language