Search code examples
byte-buddyjava-9

Can't install byte-buddy-agent on java 9


Byte buddy says that it works with java 9, there is even code for it: ByteBuddyAgent.install(ForJigsawVm.INSTANCE) I use simple ByteBuddyAgent.install() that should check all possibilities (including java 9/jigsaw), but it fails.

I'm doing something wrong? Or it doesn't support java 9 yet?


Solution

  • The support for Java 9 is still experimental but the recent versions of Byte Buddy support attachment on recent ea builds of Java 9:

    Instrumentation instrumentation = ByteBuddyAgent.install();
    

    Make sure that you are:

    1. Running a recent version of Byte Buddy.
    2. Running a recent version of Java 9.

    Do however note that Byte Buddy cannot yet process Java 9 class files due to ASM not supporting it. If you require it, use the byte-buddy-dep package and explicitly add a dependency to ASM in version 6.0_ALPHA. Doing so, allows you to use Byte Buddy on Java 9 with close to no limitations (I am still evening out some edges).