Course contentsShow
Java
Lesson 7 of 2,8701. Java Setup and First ProgramFree lesson

Verifying Your Installation with java -version

Running java -version and javac -version to confirm the JDK is correctly installed and accessible from the command line.

Verifying Your Installation with java -version

What you'll learn: How to confirm your JDK is properly installed and accessible by running simple version commands.

Why Verification Matters

Think of this step like checking that a new appliance is plugged in before trying to use it. You've installed the JDK and configured your environment variables—now you need to prove that your computer can actually find and run Java tools from anywhere on your system.

The Two Key Commands

Open your command line (Terminal on Mac/Linux, Command Prompt or PowerShell on Windows) and type:

java -version

This checks the Java Runtime Environment part of your JDK. You should see output showing your Java version number (like 17.0.1 or 21.0.2).

Next, type:

javac -version

This verifies the Java Compiler is accessible. You'll see a simpler output, just the compiler version.

What Success Looks Like

If both commands display version numbers without errors like "command not found" or "not recognized," congratulations! Your JDK is correctly installed and your PATH variable is working. The system can locate Java tools from any directory.

If Something Goes Wrong

If you see error messages, it usually means:

  • The JDK wasn't installed correctly, or
  • Your PATH variable wasn't set up properly (revisit the previous lesson)

Key Takeaway: Running java -version and javac -version confirms your JDK installation is complete and your command line can find Java tools—you're ready to start programming!