Java find out what imports a .class has [duplicate]

二次信任 提交于 2019-12-25 05:14:25

问题


Is there a way to find out what imports a class has?

In this question: Jon Skeet says that you can't do this using reflection, but

If you want to find all the types used within the compiled code, that's a slightly different matter. You may want to look at BCEL as a way of analyzing bytecode.

This is what I want to know how to do.


回答1:


Here is an old tutorial for ASM bytecode manipulation framework explaining how to read class dependencies with ASM.




回答2:


You can use a Java Decompiler like this one: Java Decompiler



来源:https://stackoverflow.com/questions/11548765/java-find-out-what-imports-a-class-has

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!