Javassist (Java Programming Assistant)
makes Java bytecode manipulation
simple. It is a class library for editing bytecodes in Java;
it enables Java programs to define a new class at runtime and to
modify a class file when the JVM loads it. Unlike other similar
bytecode editors, Javassist provides two levels of API: source level
and bytecode level. If the users use the source-level API, they can
edit a class file without knowledge of the specifications of the Java
bytecode. The whole API is designed with only the vocabulary of the
Java language. You can even specify inserted bytecode in the form of
source text; Javassist compiles it on the fly. On the other hand, the
bytecode-level API allows the users to directly edit a class file as
Aspect Oriented Programming:
Javassist can be a good tool for adding new methods into a class
and for inserting before/after/around advice at the both caller and
One of applications of Javassist is runtime reflection; Javassist
enables Java programs to use a metaobject that controls method calls
on base-level objects. No specialized compiler or virtual machine are
||Javassist version 3.18.0.GA is available (June 3, 2012).
This version is distributed
under the triple license of the MPL, the LGPL, and the Apache License.
This command will create the ./trunk direcotry.
To build the downloaded source files, use
cd trunk # move to the source directory
ant jar # build javassist.jar
ant javadocs # build API reference
For more details, see
Join our discussion forums:
- Discussion Forums
[ Users ]
[ Developers ]
Javassist: Java Bytecode Engineering Made Simple
by Shigeru Chiba, Java Developer's Journal, vol. 9, issue 1, January 8, 2004.
Java programming dynamics, Part 4: Class transformation with Javassist
by Dennis M. Sosnoski, IBM developerWorks, September 16, 2003.
Java programming dynamics, Part 5: Transforming classes on-the-fly
by Dennis M. Sosnoski, IBM developerWorks, February 3, 2004.
Java programming dynamics, Part 6: Aspect-oriented changes with Javassist
by Dennis M. Sosnoski, IBM developerWorks, March 2, 2004.
An Easy-to-Use Toolkit for Efficient Java Bytecode Translators
Shigeru Chiba and Muga Nishizawa
Proc. of 2nd Int'l Conf. on Generative Programming
and Component Engineering (GPCE '03),
LNCS 2830, pp.364-376, Springer-Verlag, 2003.
(The performance of Javassist)
Using HotSwap for Implementing Dynamic AOP Systems
Shigeru Chiba, Yoshiki Sato, and Michiaki Tatsubori
ECOOP'03 Workshop on Advancing the State of the Art in Runtime Inspection (ASARTI), July 21st, 2003.
(Dynamic AOP, An Application of Javassist)
AOP in the Academia
Shigeru Chiba, JBossTwo AOP Panel, June 2003.
A Bytecode Translator for Distributed Execution of "Legacy" Java
Michiaki Tatsubori, Toshiyuki Sasaki, Shigeru Chiba and Kozo Itano
ECOOP 2001 -- Object-Oriented Programming,
LNCS 2072, Springer Verlag, pp.236-255, 2001.
(An application of Javassist)
Load-time Structural Reflection in Java
ECOOP 2000 -- Object-Oriented Programming, LNCS 1850,
Springer Verlag, page 313-336, 2000.
(The overview of Javassist)
Javassist --- A Reflection-based Programming Wizard for Java
In Proceedings of the ACM OOPSLA'98 Workshop
on Reflective Programming in C++ and Java
(An very early sketch of the design of Javassist)
We are developing other reflective systems for C++ and Java.
An extensible C++ preprocessor based on compile-time reflection.
An extensible Java preprocessor based on compile-time reflection.
Javassist version 2.4 is also available (February 20, 2003)
This version is distributed under the Mozilla Public License 1.1.
Javassist version 1.0 is also available (July 24, 2001).
The development of Javassist was supported in part by the PRESTO
and CREST programs of
Japan Science and Technology Agency.