Java Get Started

Install the JDK and run your first program.

✍️ 2 exercises in this lesson
  1. Install a JDK (Java Development Kit), e.g. Eclipse Temurin or Oracle JDK, version 17 or 21.
  2. Check it in a terminal: java -version
  3. Save your code as Main.java. The file name must match the public class name.
  4. 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.

Java Get Started Practice Exercises

Check what you learned in “Java Get Started”.

/ 2 solved
Fill in the blank

Compile Main.java.

 Main.java
✓ Correct! Not quite. Try again.
Multiple choice

The file name must match…

✓ Correct! Not quite. Try again.
to save your exercise progress.
Finished this lesson?
Mark it complete to track your progress.

Stuck on something?

Ask the community in the CodesInTech forum.

Need a developer?

Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.

Explore Our Services