简体   繁体   English

查找主类使用的所有类的方法

[英]Method of finding all the classes used by a main class

I am provided with a workspace where i have to extract few classes. 我提供了一个工作区,在这里我必须提取几个类。 I know the main classes which have to be extracted. 我知道必须提取的主要课程。 Is there a way in eclipse which lists all the classes used by this main class. eclipse中有没有一种方法可以列出该主类使用的所有类。 Indirect and direct references of this class. 此类的间接和直接引用。

For example: I have main class A which uses class B and class C. Class C internally uses class D. So for all the classes used in A should list B,C and D. 例如:我有一个主类A,它使用B类和C类。C类在内部使用D类。因此,对于A中使用的所有类,都应列出B,C和D。

You can delete the classes folder of your application and compile only the class you want to obtain dependencies for using javac where you provide the classpath of dependent jars (if any). 您可以删除应用程序的classes文件夹,并仅编译要使用javac获得依赖关系的类,在其中您提供依赖jar的类路径(如果有)。 The java compiler will find all the dependencies of this class and compile them as well: Java编译器将找到此类的所有依赖项,并对其进行编译:

javac -classpath dep1.jar;dep2.jar path.to.your.class.YourClass.java

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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