Online Java Compiler
Compile and run Java code online with OpenJDK, OOP principles and Scanner stdin. Write code with auto-formatting, test with standard input (stdin), and inspect terminal output in real-time.
Ready to Compile & Run
Click the blue ▶ Run button in the header bar or press Ctrl + Enter to compile and execute your Online Java Compiler.
How to Run Java (OpenJDK) Code Online
Develop, compile, and execute Java programs online with full object-oriented programming support.
- Keep the public class named "Main" containing the public static void main method.
- Enter any required input in the Stdin tab.
- Press "▶ Run" or Ctrl + Enter.
Common Errors & Troubleshooting
Encountering compilation or runtime diagnostics? Check these common scenarios:
class X is public, should be declared in a file named X.javaKeep the main class named "Main" (public class Main).Related Popular Language Compilers
View all 35+ compilers →Write, run and test Python 3 code in your browser with interactive standard input
Execute modern ES6+ JavaScript code in an isolated high-speed runtime
Type-safe JavaScript playground with instant transpilation and type validation
Multi-pane web editor with live preview, responsive device frames and instant rendering