Set up your computer
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
Run Java on your own computer
- This playground is great for learning — but it runs on our server.
- For your own projects, it helps to set Java up on your computer.
- It takes about 15 minutes, and you only do it once.
Step 1 — Install the JDK
- To run Java you need a JDK (Java Development Kit) on your computer.
- A free, easy choice is Eclipse Temurin from adoptium.net — pick JDK 21.
- Download the installer for your system (Windows, macOS, or Linux) and run it.
Step 2 — Install VS Code
- VS Code (Visual Studio Code) is a free, popular code editor from Microsoft.
- Get it from code.visualstudio.com and install it.
- This is where you will write and run your code.
Step 3 — Add the Java extension
- Open VS Code and click the Extensions icon on the left.
- Search for Extension Pack for Java (the one by Microsoft) and click Install.
- It adds run buttons, colours, and helpful hints for Java.
Step 4 — Check it worked
- Open a terminal (in VS Code: Terminal → New Terminal) and type:
java --version
- You should see something like
openjdk 21. If you do, you are ready.
Step 5 — Run your first file
- In VS Code, make a new file called
Main.javaand type:
public class Main {
public static void main(String[] args) {
System.out.println("Hello from my own computer!");
}
}
- Press the ▶ Run button (top right) above the
mainmethod. - You just ran Java outside the browser.