Install a JDK (Java Development Kit), e.g. Eclipse Temurin or Oracle JDK, version 17 or 21.
Check it in a terminal: java -version
Save your code as Main.java. The file name must match the public class name.
Compile and run: javac Main.java then java Main. With Java 11+, java Main.java does both.
Popular editors: IntelliJ IDEA, Eclipse and VS Code with the Java extension.
💡 Key Takeaways: Java Get Started
Mastering Java Get Started helps you write clean and reliable Java code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.
Java Get Started Code Example
Java
public class Main {
public static void main(String[] args) {
System.out.println("Java version: " + System.getProperty("java.version"));
}
}
Output
Java version: 21.0.4
Run this example on your own computer. The "Get Started" lesson shows how to set it up.