Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Java in General and the fly likes reading import statement from class file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "reading import statement from class file" Watch "reading import statement from class file" New topic
Author

reading import statement from class file

manojdesai sompadi
Greenhorn

Joined: Apr 22, 2005
Posts: 10
is there a way to read the import statement from class file .
like from bytecode
thanks in advance
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24189
    
  34

Import statements are just directives to the compiler; they are not represented in any way in a .class file.

If you're interested in probing what other classes a class uses directly, then that can indeed be done by looking at the class file; look in the constant pool for class references.


[Jess in Action][AskingGoodQuestions]
manojdesai sompadi
Greenhorn

Joined: Apr 22, 2005
Posts: 10
thanks for the reply what is the constant pool ?
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: reading import statement from class file