bytecode
JEP 457 Hello World Translator
If you're new to Java class files and Java bytecode check out JEP 457 Hello World which is an introduction to the topic.
Often, when you start to learn a new language you'll write a "Hello World" application as a first step. In this post, as a first step to transforming Java class files, we'll write a "Hello World" translator.
We'll see how, in just a few lines of code using the JEP 457 Java Class-File API, we can create an application that can apply a code transformation to automatically translate "Hello World" to some other language such as "Hallo Wereld".
Build A Compiler With The JEP 457 Class-File API
This is an updated version of the Java Advent 2023 article "My First Compiler" using the JEP 457 Class-File API instead of ProGuardCORE for class file generation.
As a Java developer you probably spend a lot of time writing Java source code and executing a Java compiler to convert that human readable Java source into machine readable bytecode stored in Java class files.
If you've ever wondered how a compiler works or how a Java compiler creates Java class files, then keep reading! We'll work through writing a compiler for a simple programming language that compiles to Java bytecode.
We'll implement a compiler for the esoteric programming language Brainf*ck, which is simple enough that it doesn’t require much code to create a working compiler.
JEP 457 Hello World
This is an updated version of the Java Advent 2022 "JVM Hello World" using the JEP 457 Class-File API.
Writing a “Hello World” program is often a rite of passage for a software engineer when learning a new language.
If you’re a Java developer, you might even remember the first time you typed public static void main(String[] args) in your editor of choice. But did you ever wonder what’s inside that “.class” file that the compiler spits out? Let’s look at how we can write a JVM “Hello World” by creating a class file programmatically.
We’ll work through creating a class file for the following simple Java Hello World application.
JVM Hello World
Writing a “Hello World” program is often a rite of passage for a software engineer when learning a new language.
If you’re a Java developer, you might even remember the first time you typed public static void main(String[] args) in your editor of choice. But did you ever wonder what’s inside that “.class” file that the compiler spits out? Let’s look at how we can write a JVM “Hello World” by creating a class file programmatically.
We’ll work through creating a class file for the following simple Java Hello World application.