ByteHook is a zero-dependency Java bytecode manipulation tool powered by the JDK 25 ClassFile API. It allows for live instrumentation, runtime transformation via a Java Agent, and visual verification through a side-by-side decompiler GUI.
bytehook-core: The transformation engine.bytehook-decompiler: A basic source reconstruction engine for verification.bytehook-agent: A Java Agent for runtime instrumentation.bytehook-cli: Command-line tool for offline class modification.bytehook-gui: A JavaFX workbench for visual bytecode analysis.
./gradlew assembleLoad a .class file, type a message, and see the injected code instantly.
./gradlew :bytehook-gui:runInstrument any class starting with TestApp at load-time.
java -javaagent:bytehook-agent/build/libs/bytehook-agent.jar="My Hook" TestAppModify a .class file and save it as -hooked.class.
java -cp bytehook-cli/build/libs/bytehook-cli.jar:... org.bytehook.cli.Main MyClass.class "Injected!"- JDK 25 Native: No external dependencies (no ASM, no ByteBuddy).
- Live Diff View: GUI shows original vs. instrumented source side-by-side.
- AOP Hooks: Easy method entry/exit interception.
- High-Fidelity: Preserves original logic while injecting synthetic instructions.