JEP 457 Class-File API is a preview API 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".
Lines 14 to 19 in ea854cd
You'll need JDK 22 and easiest way to install this on Linux is with SDK man:
sdk install java 22-open
If you have Java 22, you can then execute the run.sh
script which will
compile and execute Main.java
. Main
will create a Java class HelloWorld.class
which will then be executed.
$ ./run.sh
There are many similar projects for parsing, generating, and transforming Java class files, including: