In Java, is it possible to know whether a class has already been loaded?

前端 未结 5 424
不知归路
不知归路 2020-11-27 03:55

Is it possible to know whether a Java class has been loaded, without attempting to load it? Class.forName attempts to load the class, but I don\'t want

5条回答
  •  旧巷少年郎
    2020-11-27 04:24

    You can use the findLoadedClass(String) method in ClassLoader. It returns null if the class is not loaded.

提交回复
热议问题