当使用java -cp path1:path2:path3 SomeClass
执行一个类时,是否可以让java
报告它为在该类中导入的每个包找到的jar或类文件名和路径名?
No ... and partly yes.
No because "importing" is a compile time concept only. There is no need to import
a class in order to use it, and an import
statement doesn't actually mean that the class is actually used. Also, you don't import a package: you import classes from a package, or static members from a class.
Partly yes because the java -verbose:class
option will log each class that gets loaded by the JVM.
And if you want to statically find all of the other classes that are directly referenced by a given class it is possible to get this by analyzing the classes .class
file.
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.