Install

Install

A school program needs reliable data and clear rules. A Java Development Kit, or JDK, supplies the compiler and runtime needed to build programs. Confirm both tools before blaming your source code for a setup problem.

  1. Understand

    A Java Development Kit, or JDK, supplies the compiler and runtime needed to build programs.

  2. Apply

    Trace the Java example, predict its output and explain the result before running it.

  3. Avoid mistakes

    A command that cannot be found usually needs installation or PATH configuration; it is not a Java syntax error.

Install Java on Your System

Based on your Operating System, you may the following installation instructions.

  1. Install on Linux
  2. Install on macOS
  3. Install on Windows 10
  4. Install on Windows 11

Important boundaries and mistakes

A command that cannot be found usually needs installation or PATH configuration; it is not a Java syntax error.

Try the school example

Before running this Java program, write down each line you expect to see. Identify the value, branch, object or exception responsible for each line. Then explain whether the following assumption is valid: A command that cannot be found usually needs installation or PATH configuration; it is not a Java syntax error..

Java 17 · Main.java · complete practice program

public class Main  {
  public static void main(String[] args)  {
    System.out.println(System.getProperty("java.specification.version"));
  }
}

Worked answer and reasoning

Java 17 · Main.java · source repeated for this answer

public class Main  {
  public static void main(String[] args)  {
    System.out.println(System.getProperty("java.specification.version"));
  }
}

Expected output on the Java 17 teaching runtime; your installed version can differ

17

A Java Development Kit, or JDK, supplies the compiler and runtime needed to build programs. Confirm both tools before blaming your source code for a setup problem.

A command that cannot be found usually needs installation or PATH configuration; it is not a Java syntax error.

Run with javac Main.java, then java Main. The declaration of Main names the class; main starts the example, and println writes a complete output line.

Check your understanding

For the complete practice program in this lesson, which output is expected on Java 17?
Choose one answer. You can try again.

Answer and explanation

17

A Java Development Kit, or JDK, supplies the compiler and runtime needed to build programs. Confirm both tools before blaming your source code for a setup problem. A command that cannot be found usually needs installation or PATH configuration; it is not a Java syntax error.

What to remember

A Java Development Kit, or JDK, supplies the compiler and runtime needed to build programs. Confirm both tools before blaming your source code for a setup problem. A command that cannot be found usually needs installation or PATH configuration; it is not a Java syntax error.

Related explanations: Java Variables, Java If Statement - Syntax and Examples, Java Class - Blueprint of Objects, Exceptions in Java Introduction.

Supporting documentation: Official Java learning guide and Java 17 language specification.

Reaching the recap and completing the quizzes are separate milestones.

    Next lesson: Install On Linux →