Results 1 to 12 of 12

Thread: javap

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    javap

    Is there anyway i can run the disassembler and get a human readable version of the whole .class file. If the disassembler is run a human readable verson of the API defined by the specified class is produced. If javap is run with the -c switch the API is produced along with the byte code. The API is readable but the byte code is somewhat hard to interpret.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Bytecode? Isn't it bytecode assembly?

    Assembly is hard to interpret, that's a fact. There are some java decompilers on the web, try searching for them on google.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    jad is the best I know, unfortunatly its location is a tripod member page that is unavailable most of the time.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    It dosen't look like Assembly. Try disassembling a .class file using javap. Tell me what you think.

    C:\jdk1.3\bin> javap -c -classpath C:\Dirs; Class

  5. #5
    Fanatic Member JCScoobyRS's Avatar
    Join Date
    Oct 2002
    Location
    Some Mountain in Colorado
    Posts
    677
    DJDecompiler is great. It takes a class file and turns it into the original .java file. If you're interested, let me know. Later, Jeremy
    He who listens well, speaks well.

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Code:
    Method void init()
       0 getstatic #3 <Field java.io.PrintStream out>
       3 ldc #4 <String "Initializing">
       5 invokevirtual #5 <Method void println(java.lang.String)>
       8 aload_0
       9 invokevirtual #6 <Method java.awt.Rectangle getBounds()>
      12 getfield #7 <Field int width>
      15 istore_1
      16 aload_0
      17 invokevirtual #6 <Method java.awt.Rectangle getBounds()>
      20 getfield #8 <Field int height>
      23 istore_2
      24 aload_0
      25 iload_2
      26 iload_1
      27 multianewarray #9 dim #2 <Class [[B>
      31 putfield #2 <Field byte arHeight[][]>
      34 aload_0
      35 aload_0
      36 invokevirtual #10 <Method java.net.URL getCodeBase()>
      39 ldc #11 <String "asg.png">
      41 invokevirtual #12
        <Method java.awt.Image getImage(java.net.URL, java.lang.String)>
    Well, if that doesn't look like assembly I don't know what does.
    Always the same scheme:
    ByteOffset OpCodeName [Parameters]
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7

  8. #8
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    Originally posted by CornedBee
    Well, if that doesn't look like assembly I don't know what does.
    Always the same scheme:
    ByteOffset OpCodeName [Parameters]
    It's bytecode.

    Take a look at http://www.mozilla.org/projects/ef/t.../examples.html to see an example of java source code and the corresponding bytecode and x86 assembler code.

  9. #9
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    No, it's assembly. Bytecode would be just that, bytecode. It would look the same as machine code. This is bytecode assembly, and it looks very much like other assembly, especially MMX or SSE assembly (the normal x86 instruction have only 2, 3 or 4 letters).
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  10. #10
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    Bytecode is the machine language of the VM, not the platform on which it is running. If it were true machine code you wouldn't need the JVM to convert your .class files.

  11. #11
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Yeah, so?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  12. #12

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Yeah CornedBee is right in the respect that it is Assembly. I just didn't recognize it at first since im not use to looking at Assmbler code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width