The ByteCode Engineering Library (BCEL) is a library that provides a way to directly modify the bytecode of Java classes.
This repository contains slightly modified code for a three-part tutorial at GeekyArticles: Part 1, Part 2, and Part 3.
You need to download BCEL for this example to work.
- Each class in the
src
folder is run individually.- Each one except for
DisplayDetails
andExpressionCompiler
generates a class file calledSyntheticClass.class
in thebin
folder with the other class files. - For the classes that generates
SyntheticClass
you can then run theSyntheticClass
to see the results.- The tutorial links above give a little more details on how to run each class.
ExpresionCompiler
takes a string containing an expression as a command line argument and parses it, then generatesExpressionTest.class
which displays the result of the expression when itsmain
function is called.
- Each one except for