Java playground

Compile and run Java against any release from 8 to 25, without installing one. Every runnable example on this site has an Edit and run button that opens it here, already loaded — and because the page it came from claims a specific output, this will tell you whether the claim still holds.

The release selector is the part worth using. Half the content on this site turns on when something changed; switching from 21 to 11 and watching the same code stop compiling teaches that faster than reading it.

Just want to run something of your own? The Java compiler is the same editor with an empty buffer.

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.

How this actually runs

This site is a pile of static files with no server behind it, so the JVM is not ours. Your code goes from your browser straight to Compiler Explorer, which compiles and runs it in a sandbox and sends the output back. Nothing you type reaches CodeDepth — not the code, not the output. The share link stores the whole program in the part of the URL that browsers never send to a server, which is also why those links keep working with nothing stored anywhere.

What it will not do

  • Threads. The sandbox caps the process at one, so Thread, executors, CompletableFuture and parallel streams all fail with unable to create native thread. No JVM flag changes it. The concurrency entries are still compiled and run against a real JDK on every deploy — just not here. Each one prints the command to run it locally.
  • Network, files or long runs. No sockets, no filesystem to speak of, and a program that does not finish in a few seconds is killed.
  • Third-party libraries. The JDK only. Anything the standard library does not ship, this cannot import.

Examples arrive here wrapped the way scripts/verify.js wraps them at build time — the same import preamble, the same generated class, the same --add-opens flags. That is deliberate: the code you are handed is the code CI compiled, so if it runs differently here, that is worth knowing rather than hiding.