Online Java compiler

Write Java, choose a release from Java 8 to 25, and run it. No account, no installing a JDK, no waiting for Gradle. Press Run, or Ctrl + Enter.

Nothing you type is stored here. The code goes from your browser straight to the compiler, and the Copy link button packs the whole program into the part of the URL that browsers never send to a server — so a link you share keeps working without anything being saved anywhere.

Ctrl / + Enter runs. Nothing you type is sent to this site — the code goes straight from your browser to Compiler Explorer, and the share link keeps it in the part of the URL browsers never transmit.

Loading the editor…

Or start from one of these

Each one behaves differently on a different release. Load it, then change the JDK.

Every runnable example on the site has an Edit and run button that lands here with the code loaded. Browse the questions.

Which release should you pick?

The selector is not decoration: the same file compiles on one release and is a syntax error on an older one. If you are checking whether a feature is available to you at work, set it to the release your project actually targets.

ReleaseWhat it gets you
Java 25 (LTS)The current release.
Java 21 (LTS)Virtual threads, pattern matching for switch, record patterns. The LTS most teams target.
Java 17 (LTS)Sealed classes. The LTS most enterprise code is still on.
Java 11 (LTS)var, the HTTP client. No records, no text blocks, no switch expressions.
Java 8Lambdas and streams arrive. Everything after this is missing.

What it will not do

Your code runs in a sandbox on Compiler Explorer, and a sandbox that will run a stranger’s code has to say no to most things:

  • No libraries. The JDK and nothing else — no Maven, no Gradle, no dependencies. If the standard library does not ship it, you cannot import it.
  • No threads. Thread, executors and parallel streams all fail here. It is a limit of the sandbox, not of your code, and the editor says so rather than showing you a confusing JVM error.
  • No network or files, and a program that does not finish in a few seconds is stopped.
  • One file. Put everything in one class, or nest the extra types inside it.

Learning Java rather than just running it?

This whole site is Java interview preparation, and every runnable example on it is compiled and executed against a real JDK on every deploy, with its output checked against what the page claims. Open one from the playground and it arrives in this same editor, already loaded, and tells you whether the claim still holds. Or start with the question bank and the learning roadmap.