Can you find all classes in a package using reflection?

前端 未结 27 2151
不知归路
不知归路 2020-11-21 05:24

Is it possible to find all classes or interfaces in a given package? (Quickly looking at e.g. Package, it would seem like no.)

27条回答
  •  旧巷少年郎
    2020-11-21 05:50

    Provided you are not using any dynamic class loaders you can search the classpath and for each entry search the directory or JAR file.

提交回复
热议问题