Visualize binary bytecode

Is there a tool that would allow me to see the binary of the Java byte code for comparison against the disassembled code (i.e. see the actual '0's and '1' that correspond to a given byte code)?
Thanks in advance,

Thanks, I've just tryed it but probably I'm explaining myself wrongly.
I get the hexa of the whole file, however I don't get any delimitations just a bunch of hexa that I cannot relate to the disassembled Java bytecode. I would like to see which bits correspond to which bytecode LINE by LINE. Here I get the correspondence of a whole disassembled file with a whole hexa file, but I need more detail and to be able to see it instruction by instruction. Probably it should be something like [objdump -d|http://linux.die.net/man/1/objdump] but for Java.
Thanks again, I appreciate very much your help
Edited by: jernestop on Oct 27, 2009 1:16 AM

Similar Messages

  • How to visualize java bytecode?

    Hey guys
    I'm here again with another question for you.
    That you know, is there a way to visualize and see the bytecode of a program in Java? if yes can you please tell me how to do this?
    Thanks in advance.
    Maddy

    I dont think u can insert anything into to a .class file.So not true. How do javac, jikes, jasmin and several other compilers / translators work then?
    There are several APIs for doing that. Check the link I gave. And this: http://directory.google.com/Top/Computers/Programming/Languages/Java/Class_Libraries/Data_Formats/Java_Class_Files/
    CafeBabe is a graphical tool but it is far from finished right now: http://jfa.javalobby.org/projects/CafeBabe.html
    I'm sure there are lots of others... I was browsing the 'net the other day and became momentarily intressed in this. I found a myriad of different tools - even graphical ones - but I can't seem to be able to find them now :(
    infact as far as i know, even if u delete a char and retype the same char the verifier will complain.If you use a text editor, of course. The different character encodings and null bytes mix things up pretty badly, you know... You can't even open and save an casual GIF file in Notepad so that the result will be valid GIF!

  • Jikes Bytecode Toolkit

    Jikes Bytecode Toolkit is a 100% Java class library that enables Java programs to create, read, and write binary Java class files and to query and update a single, high-level representation of the collection of them, including relationships among them. These features allow the development of tools that report on what APIs the classes use, reorder and change instructions, merge or extend classes, add customized instrumentation (similar to profilers), analyze control and data flow, etc.
    http://www.alphaworks.ibm.com/tech/jikesbt?open&ca=dgr-awjw03jikesbt

    I was pointed out that sample did not include any source, which makes it
    hard to run or change.
    A new version of the Eclipse Monitor sample should be available soon at
    AlphaWorks.
    Chris Laffra
    "Chris Laffra" <[email protected]> wrote in message
    news:bi0iog$dm7$[email protected]..
    > If you are interested in visualizing eclipse plugins (watching pre-canned
    > ones or creating your own), check out the Eclipse Monitor shipped with the
    > Jikes Bytecode Toolkit (jikesBT). Using bytecode instrumentation, plugin
    > jars are modified and the resulting introspection events are used to draw
    > plugins and their communication and execution:
    >
    > http://www.alphaworks.ibm.com/tech/jikesbt
    >
    > The visualization runtime is a plugin itself and declares an extension
    point
    > for people to define their own custom visualization (a sound generator and
    > profiling tool is included). All this to be demoed at OOPSLA'03 at the
    > demonstrations and posters track:
    >
    > http://oopsla.acm.org
    >
    > The Eclipse Monitor is shipped as an example in source code with JikesBT,
    > because frankly we don't quite know what to do with it yet.
    Recommendations
    > (such as moving it to an eclipse technology under CPL) are welcome.
    >
    > Chris Laffra
    > principal author of JikesBT and the Eclipse Monitor
    > IBM Ottawa
    >
    >
    >

  • Encode Bytecode in source field to base64 in target field

    Hello,
    I have already posted a similar question regarding base64 encoding of attachment. However now the bytecode is sent in a single field in the source message. This bytecode has to be encoded in base64.
    So far I have not found any solution to do so. I have read about the following API com.sap.aii.utilxi.base64.api.Base64  which should contain two static methods for encoding end decoding.
    However the package cannot be found when trying to import it into an UDF. As this API is not documented, could it be that it is not available anymore on PI 7.1?
    What other possibilites do I have? Do you have any idea? I
    Thank you very much!

    Hi Florian,
    com.sap.aii.utilxi.base64.api.Base64 is no official API, so there is no official documentation on this. Also, if you use this, there can be a possibility that changes might occur in this class without any notice.
    This class has two static methods:
    String encode(byte[]) // binary -> base64
    byte[] decode(String) // base64 -> binary
    Try looking for this class in aii_utilxi_misc.jar, which can be found on PI server - C:\usr\sap\*\*\j2ee\cluster\server0\bin\ext\com.sap.xi.util.misc
    Hope this helps.
    Regards,
    Neetesh

  • Application to visualize program flow

    I'm looking for an easier way to "visualize" what is going on in the source code of a large project, in regards to function calls, method calls, and classes.
    For example, a source directory of a project will have a bunch of files, like this:
    anim.c
    character.c
    direction.c
    game.c
    input.c
    main.c
    player.c
    resources.c
    room.c
    screen.c
    If I didn't know anything about this project, if I wanted to try to understand how it works it would be difficult to start.
    Does anyone know of an application that will read source code and display a tree-like output of the program flow? For example, maybe like this:
    main() [main.c]
    -> create_game() [game.c]
    -> reset_timer() [timer.c]
    -> update_game() [game.c]
    ---> update_world() [world.c]
    ---> is_game_over() [game.c]
    ---> ...
    -> draw_game() [game.c]
    ---> draw_world() [world.c
    ---> ...
    -> destroy_game() [game.c]
    How about for classes and method calls?
    I don't care if it's GUI or CLI, or what programming language it's for. I think a program like this would be incredibly useful, especially in the FOSS community, and would be surprised if something doesn't already exist.

    cflow - For C programs. Nice and simple.
    KCacheGrind - Uses the "callgrind" application. I couldn't find callgrind in the Arch repositories or the AUR, so I gave up.
    codeviz - For C and C++ programs. I got it to produce a beautiful PNG tree of all of my function calls. I probably won't use it. A graphical tree output isn't so useful to me, and it was a bit tricky to actually setup and use. (for example, it requires a patched version of GCC)
    egypt - For C programs. Super duper simple concept, but requires some setup to use. I couldn't figure out how to configure and run it.
    gprof - Part of the GNU Binary Utilities. A little too low level for what I was looking for.
    pycallgraph - For Python programs. I didn't try it.
    doxygen - Is able to create documentation for anything in the world, including your car. I wish someone could tell me, "Type this doxygen command to create a call graph", but until that happens, I just can't seem to figure it out.
    cflow is definitely my favorite. I will do some post processing to the output to remove any functions that I didn't write.
    EDIT: Someone did a similar "review" to mine here, along with mentioning more programs to try out: http://grok2.tripod.com/code_comprehension.html
    Last edited by drcouzelis (2010-10-07 13:13:45)

  • Binary threshold - U16 Image

    I have a simple example which I have attached (Vision 2013 but can save for previous if need be) in which I would like to apply binary thresholding to a range of values (minimum --> mean) in a U16 image.  This example is based on the particle analysis binary threshold example included with Vision for U8 images.  The thresholding does not appear to be working properly (to hilte the range of values red) and areas outside of the range appear to be getting thresholded as well.  Ultimately, what I would like to be able to do is actually display the gray scale (rather than binary) image and have the thresholded range show in red against the gray scale image.
    Any thoughts.
    Solved!
    Go to Solution.
    Attachments:
    U16 Threshold Example.llb ‏4 KB

    Bruce -
    Thanks for taking the time to reply.  The first question that needs to be answered is if the binary thresholding VI is properly working to hilite in red the range of values I have specified (non-zero min --> mean) for a U16 image.  The U8 version of this example VI works just fine.  I wanted someone to run my VI and see that what is getting hilited does not seem to match up with the non-zero min --> mean range.
    In terms of thresholding on top of an actual gray scale image, another idea is to just find the pixels that fall within the range I have specified, and draw an overlay of points on top of the image.  That should work fine.  However, this is mainly for visualization purposes.
    I really need the thresholding itself to work properly for 16-bit images in order to do a particle analysis.  So I needed a sanity check to see if somehow I am doing something wrong in the thresholding (this is a pretty simple VI, not sure what could be going wrong, so am wondering if it is not properly operating on U16 data).
    Sincerely,
    Don

  • Visualization of the separation plane for the two-variable SVM case

    Hello,
    I have an training data set for binary classification task that contains only two variables.
    After building SVM model (with linear kernel) I want to visualize separation plane.
    After reading documentation I found that I can get variable weights using this query:
    WITH
    mod_dtls AS (
    SELECT *
    FROM TABLE(DBMS_DATA_MINING.GET_MODEL_DETAILS_SVM('<MODEL_NAME>'))
    model_details AS (
    SELECT D.class, A.attribute_name, A.attribute_value, A.coefficient
    FROM mod_dtls D,
    TABLE(D.attribute_set) A
    ORDER BY D.class, ABS(A.coefficient) DESC
    SELECT class, attribute_name aname, attribute_value aval, coefficient coeff
    FROM model_details
    WHERE ROWNUM < 100
    So, after getting these weight does anybody knows how to plot the separation plane?
    How to get equation of the line that separates my two classes?

    WITH
    mod_dtls AS (
    SELECT *
    FROM TABLE(DBMS_DATA_MINING.GET_MODEL_DETAILS_SVM('SAMPLE_DATA65805_SV'))
    model_details AS (
    SELECT D.class, A.attribute_name, A.attribute_value, A.coefficient
    FROM mod_dtls D,
    TABLE(D.attribute_set) A
    ORDER BY D.class, ABS(A.coefficient) DESC
    SELECT class, attribute_name aname, attribute_value aval, coefficient coeff
    FROM model_details
    WHERE ROWNUM < 100 ;
    CLASS     ANAME     AVAL     COEFF
    0     X          -1.745703462
    0               -0.928055641
    0     Y          0.813909145
    For the linear discriminant the plane separating two classes is -1.745703462x+0.813909145y-0.928055641=0. Or the linear discriminant is y~=2x+1. Unfortunately ODM GUI doesn't provide a method to plot this. In here an important thing to keep in mind that the discriminant function is generated with respect to normalized data (if you choose to do normalization). If you wish to draw some plots by using a self generated method, you should draw discriminant function over normalized data (or you can transform discriminant function).
    Regards,
    HS

  • Reading the package statement out of bytecode

    hi,
    i got 2 questions about the java bytecode:
    1. is it possible to read out the package statement of a bytecode (.class) file?
    2. what is bytecode? a layer between ascii and binary?
    regards squibe.

    1. is it possible to read out the package statement of a bytecode (.class) file?
    Yes. You can use java.lang.ClassLoader.defineClass() to get the class (write a class to extend ClassLoader), then use java.lang.Class.getPackage().
    what is bytecode? a layer between ascii and binary?
    Bytecode is binary instructions for the Java Virtual Machine. The JVM translates them to native instructions.

  • Can I transform this in bytecode?

    Hi guys
    Here I am again.
    I have this file.
    I compile it so I can Obtain the class file.
    Can I obtain from the class file a binary file?
    If yes how can I do this?
    (bytecode means binary file no?)
    The file is:
    import java.net.*;
    import java.io.*;
    import java.util.*;
    public class CollabServer {
    public int contator,contatore,cont;
    public CollabServer() throws IOException {
    contator = 0;
    contatore = 0;
    cont = 0;
    ServerSocket server = new ServerSocket(5000);
    System.out.println ("Accepting connections...");
    while(true) {
    if(contatore< 3){
    Socket client = server.accept();
    cont++;
    System.out.println ("Accepted from " + client.getInetAddress());
    new CollabHandler(client,cont).start();
    contatore = CollabHandler.activeCount();
    System.out.println ("contatore e' : " + contatore);
    contator = CollabHandler.activeCount();
    if (contator == contatore - 1) { contatore --; cont--;}
    if (cont == 2) { server.close();}
    public static void main(String args[]) throws IOException {
    new CollabServer();
    Any suggestions are treasure for me.
    Thanks Maddy

    Another example of source code more simple can help you have some ideas?
    here's the source code:
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class window1 extends JFrame {
    public window1() {
    setSize(400,150);
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE);
    Map2 msg1 = new Map2();
    this.getContentPane().add(msg1);
    setVisible(true);
    class Map2 extends JPanel {
    public void paintComponent(Graphics comp) {
    Graphics2D comp3 = (Graphics2D)comp;
    comp3.drawString(" this is an example", 50, 50);

  • Do you read/edit bytecode

    hi,
    i was just wondering if (m)any of us read and/or edit their compiled classes (with some binary editor)?
    so, if you do, then on what occasions...
    i have done it once to look leet, but i only changed name of HelloWorld, and the string it printed out... and that because i had no compiler on that computer...
    but can anyone bring an example where altering bytecode could be used, besides showing off in front of first year students?

    I wrote a class file dissassembler to scan a class file, and currently write out detailed information in an XML file.
    Some day I might get around to drawing pretty inheritance graphs, call graphs and variable usage graphs..... If you're using 3rd party software and want nice documentation, or to reverse engineer code, then it would be very handy. Everyone hates jumping into a huge undocumented
    class framework.
    But it's purely an intellectual exercise... until I smell some easy money :-)
    As for editting class files... I was trying to find clever ways to protect code from reverse engineering... but all depends on creating a
    custom classloader which itself is protected from being reverse engineered!

  • Java to binary

    Those of you of a sensitive disposition please read no further.
    Okay, can anyone else give me information regarding the production of binary executables from Java sources (or bytecode).

    Funny, I asked this question just a few days ago. The response I got was that the compilers out there aren't very good. You might want to take a stab at converting the code to a language such as C++ with ahead-of-time compiling. Why, may I ask, do you want to compile?

  • Java Bytecode error

    I am programming a program in Java Bytecode as an assignment. I am using Jasmin to compile the code.
    My program generates a random int between 0-1000 then converts that number into a string that is the binary equivalent of that number, then prints it out.
    I am getting an error though and I am not sure what the error means, or where the error is happening...so I heard the people here on the java forums can be very helpful so I decided to see if you could help me. Any Suggestions?
    Error:
    Exception in thread "main" java.lang.NoClassDefFoundError: java/util at IntToBinary.main(IntToBinary.j)
    .class public IntToBinary
    .super java/lang/Object
    ; standard initializer
    .method public <init>()V
       aload_0
       invokenonvirtual java/lang/Object/<init>()V
       return
    .end method
    .method public static main([Ljava/lang/String;)V
           ; set limits used by this method
           .limit locals 4
           .limit stack 4
           ;generates a Printsteam and stores it
           getstatic java/lang/System/out Ljava/io/PrintStream;
           astore_0
           ;Generates a Random Object
           getstatic     java/util/Random Ljava/util/Random;
           ;Push 1001 on stack, cause we only want numbers inbetween 0-1000
           sipush 1001
           ;This now gets me a random integer between 0-1000
           invokevirtual     java/util/Random.nextInt(I)I
           ;This takes in the int and puts out the binary equivalent in a string
           invokestatic     java/lang/Integer/toBinaryString(I)Ljava/lang/String;
           ;These are the methods/variables to print our result off
           astore_3
           aload_0    ; push the PrintStream object
           aload_3    ; push the string we just created - then ...
           invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
           ; done
           return
    .end method

           ;Generates a Random Object
           getstatic     java/util/Random Ljava/util/Random;The comment's wrong. It doesn't generate anything. Instead it tries to get the field Random from the class java.util - hence the error you're seeing.

  • Bytecode problem

    Hi all,
    I have following piecse of byte code which is not running:
    0 bipush 0
    2 anewarray #4 <java/lang/Object>
    5 astore 1
    7 sipush 1
    10 aload_0
    11 aload 1
    13 invokestatic #30 <com/test/AClass.aMethod>
    16 pop
    17 return
    The source declaration of the called method aMethod is:
    public static Object aMethod(int a, Object b, Object[] c)
    The constructor you see the byte code here:
    public SuperCrazyClass()
    When i try to execute the Constructor i get following error printed in console:
    Exception in thread "main" java.lang.VerifyError: (class: SuperCrazyClass, method: <init> signature: ()V) Expecting to find object/array on stack
    As you know <init> is the internal name of all constructors, together with the signature you can see that error must be located inside the bytecode snippet above. That byte code snippet is generate by custom binary instrumentation framework i wrote and it works for a lot of different methods but in that case, and i really don't know what is wrong with it, it doesn't.
    Any idea what I'm doing wrong ?
    Regards,
    bgnahm
    PS: I previously posted also in the Hotspot Forum, but i think this question fits better here...sorry for that

    bgnahm wrote:
    PS: I previously posted also in the Hotspot Forum, but i think this question fits better here...sorry for thatNo, the other forum is at least more related to the class format. I'm locking this thread. People who are reading this can still answer the original thread at:
    [http://forums.sun.com/thread.jspa?threadID=5443852]
    Kaj

  • Bytecode manipulation

    Hi,
    I more or less wrote a small binary instrumentation toolkit which is needed for special purposes. I create a class with two methods at runtime. First method is the default constructor ( needed for instance creation ), and single, not static, method containing whatever.
    The bytecode of the second method was cutted out from another class. All needed references in the bytecode are fixed correctly. I pass an additional parameter when i call the method. This parameter is the this-instance of the original method. My idea was to replace all
    opcodes which are using the this reference by the additional passed reference of the original this-instance.
    For not beeing forced to change all related this-instance opcodes, i thought maybe it is possible to overwrite the this instance like that:
    0 wide
    1 aload 5
    4 wide
    5 astore 0What this code does is it pushed the reference of the 6th element of the method stack and stores it in the first slot on the stack, which is reserved for the this instance if the method is a non-static one.
    Currently i get following error when i try to call the method:
    "Exception in thread "main" java.lang.VerifyError: (class: OHP1239475266A, method: OHP1239475266AM signature: (ILjava/lang/String;D[Ljava/lang/Integer;Lmuh/AClassWithAMethod;)Ljava/lang/Boolean;) Incompatible type for getting or setting field"
    Any idea whether this error could be connected the my technique to overwrite the this instance of a method ? Maybe this is considered to be an illegal technique.
    Thank you for your help,
    bgnahm                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    http://jakarta.apache.org/bcel/
    The Byte Code Engineering Library is intended to give users a convenient possibility to analyze, create, and manipulate (binary) Java class files (those ending with .class). Classes are represented by objects which contain all the symbolic information of the given class: methods, fields and byte code instructions, in particular.
    Such objects can be read from an existing file, be transformed by a program (e.g. a class loader at run-time) and dumped to a file again. An even more interesting application is the creation of classes from scratch at run-time. The Byte Code Engineering Library (BCEL) may be also useful if you want to learn about the Java Virtual Machine (JVM) and the format of Java .class files.
    BCEL contains a byte code verifier named JustIce, which usually gives you much better information about what's wrong with your code than the standard JVM message.

  • About upgrading ios binary and apk android

    Hello, good afternoon everyone.
    I have a number of weekly publications that publish simultaneously on iOS and Android with the same account.
    At the request of my client:
    - Update binary on iOS
    - Change to publications v24 v28
    - To begin to escalate also save the publication (JPG High) now in PDF
    In iOS had no problems, but users Andoid we began to claim that publications are not within the kiosk.
    - I must update the apk in android to fix this issue.?
    - O how the PDF publication can not be displayed correctly in Android?
    - Changed version (v28) of affecting some users or all Android versions 4.0 4.1 4.4
    I would appreciate any response to this problem
    thank you very much
    Sebastian

    Bob, thanks for your response.
    I'll explain better, sorry but my English is bad
    A weekly magazine, with its PRO account, published since more than 1 year, 2 platforms simultaneously on iOS and Android Legacy.
    update
    - The publications were v24 before.
    are now v28
    - Format: JPG High
    PDF now (the option to zoom in Builder is active)
    We ship the new binary to Apple. Approved and is for sale with no hassles.
    But the problem arose in Android.
    Since the upgrade reflected some users who can not see the publication in Kiosk.
    -. Must also update the apk in Android to fix this problem?
    - Or the problem was to change the format to PDF, this does not visualize correctly in Android?
    Sorry, I have not much experience on Android.
    Thank you Bob

Maybe you are looking for