JEP 484 Class-File API (previously JEP 457 and JEP 466) is an API introduced in Java 24 to provide a standard API for parsing, generating, and transforming Java class files.
The example here shows how easy it is to use to create a new class that prints "Hello World".
You'll need JDK 24 and easiest way to install this on Linux is with SDK man:
sdk install java 24.ea.36-open
If you have Java 24, you can execute the Main.java
file which will produce a new class file HelloWorld.class
:
$ java Main.java
You can then execute the HelloWorld
class file:
$ java HelloWorld
Hello World
There are many similar projects for parsing, generating, and transforming Java class files, including: