Article:
  Using the ASM Toolkit for Bytecode Manipulation
Subject:   Simpler alternative?
Date:   2004-10-07 02:45:34
From:   rexguo

Hi!


Am I right to say that ASM is something like run-time code modification for Java?


I have a related problem but using ASM seems too hard for me because it requires knowledge at the bytecode level. I'd also like to generate classes during run-time (generate-only, modification is not required for me) -without- requiring a JDK (only JRE allowed) and without having to know bytecode. Are there any simple solution to this? Thanks!

Full Threads Newest First

Showing messages 1 through 2 of 2.

  • Simpler alternative?
    2004-10-12 12:14:11  Bill Burke | O'Reilly Author [View]

    A much much simpler alternative is Javassist:

    www.javassist.org

    It has a built in Java compiler that can compile a String at runtime and you can insert that String directly into code. Check out the Javassist tutorial on the URL above.

    Bill
  • Simpler alternative?
    2004-10-12 12:17:20  Bill Burke | O'Reilly Author [View]

    Let me expand on Javassist by saying that you do not have to know anything about bytecode to use it, yet, you can generate classes dynamically at runtime. JBoss AOP uses Javassist extensively.

    Bill