This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
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


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 ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: reading import statement from class file