Open the Playground and select Java
Open Codectionary’s Playground from the site navigation. Create a file ending in .java or open a Java example from documentation. The editor recognises Java files and highlights their syntax. Codectionary’s current Java runner expects a public class named Main, so use Main.java for the single-file example below.
The editor can hold several files, but running Java sends only the selected Java file. Other Java, HTML, CSS or JavaScript files are not compiled into the same program. This is different from a local project where a build tool can compile many source files together.
Run a selected Java file
With Main.java selected, click Run. Codectionary sends that file to its server-side execution endpoint. If the execution service is configured and available, the server submits it to a remote Java runner and returns the result to the bottom console panel. The panel reports successful output, compiler errors or execution errors. This is not Java running in the browser or inside the HTML preview.
Java execution is conditional: if the service has not been configured or is unavailable, the Playground shows a runner error instead of program output. The editor remains useful for writing code, but a local JDK is the dependable route for compiling and running Java regardless of site configuration.
Main.java — selected file
public class Main {
public static void main(String[] args) {
System.out.println("Hello, Codectionary!");
}
}Find output and diagnose errors
After clicking Run, open or inspect the bottom console panel. A successful program shows a Completed status and its standard output. A syntax or type mistake appears as compilation output; an exception during execution appears as an execution error. Read the first useful line, change the selected file, and run it again.
Try removing the semicolon after println to see a compiler error, then restore it. If you see “Java and C++ execution is not configured yet” or a temporary-unavailability message, your code may be correct; the remote service did not run it. In that case, use the local JDK walkthrough rather than repeatedly pressing Run.
Input, files and safety limits
The Java runner has an optional Program input field for standard input. It is capped, as is the submitted source, and the remote runner has short time and memory limits. A beginner program that prints a line is a suitable test; a long-running server or interactive terminal session is not.
The execution endpoint sends code and optional input to an external execution provider. Do not put passwords, access tokens, private files or personal data into the editor for remote execution. Network access is disabled for the submitted program. You cannot install arbitrary Maven or Gradle dependencies, build a multi-file project or rely on persistent file storage in this runner.
Playground versus a local JDK
The Playground is useful for editing a short standalone example and, when its remote runner is configured, checking output quickly. A local JDK gives you direct access to javac and java, works without Codectionary’s server configuration and supports normal project files and build tools. A browser HTML preview executes web code in a sandbox; it is not a Java JVM.
For serious Java learning, install a JDK and follow the first-program guide. You can use VS Code or IntelliJ IDEA to get code completion and a debugger, then move on to classes and collections.
Syntax
public class Main {
public static void main(String[] args) {
System.out.println("Hello, Codectionary!");
}
}Examples
A single-file Java runner example
Select Main.java and click Run; if remote execution is unavailable, use a local JDK.
public class Main {
public static void main(String[] args) {
System.out.println("Hello, Codectionary!");
}
}- The public class is Main because the runner expects that entry-point class.
- Only the selected Java file is submitted; other editor files are not linked in.
- println writes standard output, which the console panel displays after a successful remote run.
- A service error means the runner did not complete; it is not proof the Java source is wrong.
Best practices
- Use a single standalone public class Main for a Playground Java run.
- Treat remote runner availability and Java compiler diagnostics as different kinds of feedback.
- Use a local JDK for multi-file projects and never submit secrets to a remote runner.
Runtime & versions
Java Virtual Machine. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
Java Language Specification