I need to provide a report of which APIs are used by our code, and exactly which methods are called. For a Windows DLL, I would use “dumpbin /imports” – is there an equivalent for a Java .class file?
javap seems to be the obvious place to look, but I can’t find any options that seem to do what I’m after.
javap -c class1 class2 ... | grep invokeYou will get all the runtime calls. You should filter them from your APIs and you will get calls to imported methods.
You might also want to determine used imported fields:
javap -c class1 class2 ... | grep getstatic(search also putstatic, putfield, getfield)