Java · online compiler

Run Java online

Run Java online — Java 8 through 25, real JDK, in a Firecracker microVM.

Firecracker microVM live per-test verdicts multi-file compile

Java is still the workhorse of enterprise backends, Android, big data (Spark/Kafka), and half of the internet's payment systems. Twenty-eight years old, still shipping a new version every six months.

ls-judge runs Java with the real JDK — no wrappers, no interpreters-pretending-to-be-JVMs. Pick Java 8 for legacy work, Java 11 or 17 for the LTS mainstream, Java 21 for pattern-matching switches and virtual threads, or Java 25 for the very latest.

Both single-file execution (`java` in single-file mode) and traditional multi-file projects work. Class name and file name must match — the entry file is Solution.java with a `public class Solution` containing `main`.

Every submission gets a fresh microVM. That means real classloading, real garbage collector metrics, real timing. Verdicts stream per test case.

Starter code

What you get in Java

Clicking "Run now" opens the playground with this exact code and a matching test case pre-loaded — passes on first Run.

java
Java 25
import java.util.Scanner;
public class Solution {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    System.out.println(n * 2);
  }
}
stdin →21
expected →42
FAQ

Common questions about Java on ls-judge

Which JDK versions?
Java 8, 11, 17, 21, 22, 23, 24, 25 — all with the OpenJDK reference implementation.
What is the entry class?
Solution — the runner compiles Solution.java and invokes Solution.main(String[]).
Can I use Maven / Gradle?
No — the sandbox has no network to fetch dependencies. Bring source only.
JVM args (heap size, GC tuning)?
The runner sets sensible defaults; explicit -X flags on the free tier are not passed through.
Further reading
Also try