I don't think you can display all of the packages named in the import statements.
Just because you name a class in the import statement, doesn't mean it gets automatically loaded into the virtual machine.
I can't think of any way that the main
thread can know what packages are named in the import statements. I think that the default system classloader would have to have access to that information, but an examination of the API reveals no public methods that would allow you to access it.
Nice try... please post if you figure out how to do this (although I don't see much utility in it, it might be a nice academic exercise).
PCS
Philip Shanks, SCJP - Castro Valley, CA
My boss never outsources or has lay-offs, and He's always hiring. I work for Jesus! Prepare your resume!