Saturday, March 22, 2008

Overview

ByteML is a java bytecode/xml intreroperability framework mainly targeted at developers. This utility is issued under the GNU GPL (see license).

Features:

  • Converts a .class file to a XML file (returned as a DOM document).
  • A custom SAX event-based xml code translator is available to write to outputstreams.

Thursday, March 20, 2008

Changelog

  • 0.2 (Nov 12 2002)
    • Bug fix related to invokeinterface and iinc_w fixed in Class2Xml
  • 0.1 ( Nov 9 2002):
    • Initial Revision


Download

Download the latest binaries from the sourceforge project page, as below

Latest Release

To see a list of all file releases of the project, follow this link - All File Releases

License

This is issued under GNU GPL. You are free to use this for your research purposes and non-commercial applications only.

Here is the BibTeX entry, you can use to cite the same.
@UNPUBLISHED{byteml,
author = {Karthik Kumar Arun Kumar},
title = {ByteML - Bytecode Markup Language},
note = {Bytecode Markup Language is a JVM - XML interoperability framework},
month = {November},
year = {2002},
owner = {Karthik Kumar Arun Kumar},
keywords = {ByteML},
url = {http://byteml.sourceforge.net},
}

FAQ

What is this software ? Who are the target audience of this software ?

This is a java bytecode - XML interoperability framwork.

Java Developers who want to integrate information serialized information of .class files with their applications and want to transport it across the wire.

I want to convert my class file to the ByteML document for examining the same. How do I do it ?

Check out the shell script Class2ByteML.sh in the bin directory.
A sample run is shown as below.

$ ./Class2ByteML.sh ../test/input/Hello.class Hello.xml
This would generate the ByteML file corresponding to the java class file.

How do I build the entire source tree ?

You may need the Ant build tool to build the entire tree. After having installed Ant in your system, invoke the ant target as follows:
   $ ant makejar  
to compile all the sources

I am getting an error: Major Version (49) Minor Version(0) not supported ?

The class file parser has been written for JVM target version 1.3 and below.

Most probably the class file you are dealing with might have been decompiled with a more recent version of the java compiler.
In case you have access to the source, you can compile it for the target machine as follows.
   $ javac -source 1.3 -target 1.3 MyJavaSource.java 

Demonstration

As an example consider the following Java source file.


public class Hello {
public static void main(String [] args) {
System.out.println("Hello World");
}
}




The ByteML corresponding to the class file , Hello.xml, looks as follows.













































































































The java disassembly code (from the 'javap' utility) is shown as follows.


$ javap -c Hello
Compiled from "Hello.java"
public class Hello extends java.lang.Object{
public Hello();
Code:
0: aload_0
1: invokespecial #1; //Method java/lang/Object."<init>":()V
4: return

public static void main(java.lang.String[]);
Code:
0: getstatic #2; //Field java/lang/System.out:Ljava/io/PrintStream;
3: ldc #3; //String Hello World
5: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
8: return

}