.class file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oll3i
    Contributor
    • Mar 2007
    • 679

    .class file

    i try to analyze the class file
    i found on the internet a class file byte by byte
    but there first is the function and in my bytes first is (after constant pool) <init>
    its signature , code exceptions ....
    and after "line number of the function" which is 4 in my bytes i'm lost
    there are 18 bytes to the function "main" and i don't know what they mean
    they are
    0
    11
    0
    0
    0
    12
    0
    1
    0
    0
    0
    5
    0
    12
    0
    13
    0
    0



    then is the main function its code but not everything is in that code

    my code (to analyze) looks as follows
    Code:
    public class Decomp {
    
    	public static void main(String args[]) {		
    		AnalyzeBytes ab = new AnalyzeBytes();
    		ab.setData();
    		ab.displayBytes();
                                   //ab.displaySourceCode(); will be uncommented when i'm finished
    	}        
    }
    before the code i see that (main method) it is public and static
    then goes the name of the function main (constant pool 14)
    then i see an array of type String
    and that it returns void (constant pool 15)

    what i see in the code of the function main
    is
    Analyzebytes (constant pool 16)
    Analyzebytes (constant pool 17)
    setData (constant pool 19)
    and then displayBytes (constant pool 22)

    where should i look for the variable name "ab" ?
    and the name of the parameter "args"?


    after main there are 53 bytes more


    thank You
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Have you found the "javap.exe" tool in your JDK? It can disassemble class files for you.

    kind regards,

    Jos

    Comment

    • oll3i
      Contributor
      • Mar 2007
      • 679

      #3
      i've tried it but it is not what i want

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        What do you have in mind exactly? Have you tried a de-compiler?

        kind regards,

        Jos

        Comment

        • oll3i
          Contributor
          • Mar 2007
          • 679

          #5
          i have to write a decompiler i tried decompilers i found online but i can not use it

          Comment

          • Nepomuk
            Recognized Expert Specialist
            • Aug 2007
            • 3111

            #6
            What's wrong with those you found online? What will they and what won't they do? And which ones did you try? Writing one yourself will be a pretty big job.

            Greetings,
            Nepomuk

            Comment

            • oll3i
              Contributor
              • Mar 2007
              • 679

              #7
              i just can not use a ready code
              no worry i just write it for one class file not for every class file

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #8
                Get the JVM specification (Link is in the first thread in this forum) and read the fourth chapter.

                Comment

                Working...