Home java Machine code java program

Machine code java program

Author

Date

Category

I need

  1. get a machine code generated by the entire way to pass through my java program in the form of a file that you can say to open through a notebook and there see a pure binary code.
  2. see the generated byte code that has not yet passed the processing via JVM as a file that when you open say via Notepad, it will show the code that is transmitted by JVM if it is an assembler code, then see as an ordinary assembler code, if again the binary code is to see in binary form, and not in that incomprehensible form in which you can usually see .class when viewed through a notebook, it is clearly the code actually does not matter that the notebook usually shows, but I need to see purely The type of code that is transmitted by JVM.

Please help.

Important! I have no task Create .exe or other files, I just stupidly need to be able to see the desired codes in their correct form.

Preferably:

View of the binary code of the javac compiler and binary code, which is already performed through JVM already with a computer – as a file is preferably txt for a good opening in the notepad in such a

or so

form.


Answer 1, Authority 100%

I can’t imagine it, but you can see the binary representation of the Baitcode so

Public Class App {
  Private Static Final int screen_width = 10;
  Public Static Void Main (String [] Args) {
    Try (inputstream is = new fileinputstream ("someclass.class")) {
      int b, c = 0;
      While ((B = Is.Read ())! = -1) {
        String S = String.Format ("% 8s", integer.tobinarystring (b & amp; 0xff)). Replace ('', '0');
        System.Out.print (S + ");
        if (C & GT; screen_width) {
          System.Out.printLN ();
          c = 0;
        } else {
          C++;
        }
      }
    } Catch (IoException Exc) {
      exc.printstacktrace ();
    }
  }
}

Only you need to consider that it includes not only the code, but also all metadata without parsing.

and see in this form the machine code generated by the Jit compiler you will not be able to.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions