This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Open the source file (src.zip) in WinZip or whatever? I am not sure what you are trying to accomplish.
Joined: Jul 15, 2002
Hi frineds... Thank you for your reply...All packages mean All import packages disply at consorl or Browser.How is it?plz help me
Joined: Oct 15, 2002
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
Originally posted by Philip Shanks: 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.
The classloader doesn't have access to that information, because that information isn't part of the class file! Import statements get resolved at compile time - they are just a convenience for programmers, so that you don't have to type fully qualified classnames everywhere. With other words
will produce identical byte code to
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus