javap: fully qualified names for "new" statements

S

S.Marion

Hello,

I'm using javap for my project.
Basically, what I'm interested in are the "new", "newarray" and
"anewarray" statements.
However, javap only outputs things like:
new #10; //class StringBuffer

but does not give me the fully qualified name.

Is there any way I could get to know this information?

Cheers,

Sebastien Marion
 
S

S.Marion

Opologies for the previous email, I found the answer to my question.
I'm not sure there is a way to get the fully qualified name outputed by
javap.
However, when using the -verbose flag, javap outputs at the beginning of
the dump things like :
const #1 = class #2; // Runtime
const #2 = Asciz java/lang/Runtime;
const #3 = class #4; // Object
const #4 = Asciz java/lang/Object;
const #5 = Asciz securityManager;
const #6 = Asciz Ljava/lang/SecurityManager;;
const #7 = Asciz defaultProperties;
const #8 = Asciz Ljava/util/Properties;;
const #9 = Asciz current;
const #10 = Asciz Ljava/lang/Runtime;;
const #11 = Asciz libpath;
const #12 = Asciz [Ljava/lang/String;;
const #13 = Asciz exitSequence;
and so on.
This is then where I can get the fully qualified name from ;)

Cheers,
Sebastien Marion
 
R

Roedy Green

This is then where I can get the fully qualified name from ;)

You need a more refined tool. See http://mindprod.com/jgloss/jasm.html
to look for libraries to help you examine byte code. The string you
want is in the literal pool. There will be a reference to it an a
fixed offset. Read the class library format spec at the link I gave.

the reference comes right after the access flags. Get a hex viewer to
let you look at the first few bytes and the constant pool. It is all
pretty much the way you would expect.

A string reference is simply an index into the constant pool array
which then points you to where the string itself is and how long it
is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top