Java Get Started
You can start learning Java right here in the browser: every playground on ExcelTAD is sent to a real Java Development Kit (JDK) and the output is shown below the code. When you are ready to build your own projects, you will want Java installed on your computer too. This chapter shows both.
JDK, JRE and JVM
| Term | What it is |
|---|---|
| JVM | Java Virtual Machine — runs compiled bytecode |
| JRE | Java Runtime Environment — the JVM plus the standard library (enough to run programs) |
| JDK | Java Development Kit — the JRE plus tools such as the compiler javac (needed to write programs) |
As a developer you always install a JDK. Popular free builds include Eclipse Temurin, Oracle OpenJDK, Amazon Corretto and Microsoft Build of OpenJDK. Pick a long-term support (LTS) version such as 21 or 25 for real projects.
Checking your installation
After installing, open a terminal and ask for the version:
java -version
javac -versionopenjdk version "25" 2025-09-16
javac 25
Your exact version numbers will differ. If the command is not found, the JDK's bin folder is not on your PATH yet.
Writing and running a program by hand
Create a file named Main.java. The file name must match the public class name exactly, including capital letters:
public class Main {
public static void main(String[] args) {
System.out.println("It works!");
}
}Then compile and run it from the terminal:
javac Main.java # produces Main.class
java Main # runs the class (no .class extension!)It works!
Since Java 11 you can also skip the separate compile step for single-file programs: java Main.java compiles in memory and runs immediately.
Note: In a real project the main class is
public class MaininsideMain.java. The online compiler used by ExcelTAD stores your code under a different file name, so our playgrounds write justclass Mainwithoutpublic. Everything else works exactly the same.
Try it in the playground
Here is the same program, ready to run. Change the message, then press ▶ Run.
class Main {
public static void main(String[] args) {
System.out.println("It works!");
System.out.println("Running on Java " + Runtime.version().feature());
}
}It works!
Running on Java 26
Runtime.version().feature() returns the major version of the JDK that ran the code.
Using an IDE
For bigger programs an IDE (integrated development environment) saves a lot of time with auto-completion, error highlighting and a debugger:
- IntelliJ IDEA (Community edition is free) — the most popular Java IDE
- Visual Studio Code with the "Extension Pack for Java"
- Eclipse and NetBeans — long-standing free IDEs
Real-world projects usually use a build tool such as Maven or Gradle, which downloads libraries and compiles everything for you. You don't need any of that for this course.
A program with a little logic
Playgrounds are not limited to printing text — any standard Java works:
class Main {
public static void main(String[] args) {
int apples = 7;
int friends = 3;
System.out.println("Each friend gets " + (apples / friends) + " apples");
System.out.println("Left over: " + (apples % friends));
}
}Each friend gets 2 apples
Left over: 1
Test yourself
Which component do you need to *compile* Java programs?
- JVM
- JRE
- JDK
- A web browser
A file contains public class Greeter. What must the file be called?
- Main.java
- greeter.java
- Greeter.java
- Greeter.class
Which command runs an already compiled class Main?
- java Main
- javac Main
- java Main.class
- run Main