简体   繁体   中英

How to find class that contains main method in a package/jar using reflection?

I am using dynamic class loading which requires the main class for loading the classes. If have a package/jar i want to get the class name that contains main method? Is it possible with Reflection? or is there any other API?

Is there any method like java.net.JarClassLoader.getMainClassName() for packages too.

您需要一个牢固的第一个入口点(main方法),然后可以通过反射动态进行所有调用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM