Menu
Code Playground

Run Java 21 — instantly.

Compile and run Java with OpenJDK 21 in a secure, isolated sandbox. No installs, no setup.

Java 21 — OpenJDK
Your public class must be named Main — it's compiled with javac and run via java -cp /code Main.
Press ▶ Run to compile and execute your Java code…
Exited with error Success

Run Java Online with OpenJDK 21

Compile and execute Java directly in your browser — no JDK installation, no IDE setup. Each submission is compiled with javac and run inside an isolated, network-disabled container, making it a quick way to test class behavior, practice syntax, or work through algorithm problems.

What does my Java class need to be named?

Your public class must be named Main — it's compiled with javac and run via java -cp /code Main.

Which JDK version is used?

OpenJDK 21, running inside an isolated, network-disabled container.