Install Java on Windows |Video upload date:  · Duration: PT5M47S  · Language: EN

Quick guide to download and install Java on Windows and set JAVA_HOME and PATH so compilers and tools run properly

If you want Java on Windows with the least drama and maximum caffeine savings this guide will walk you through downloading a JDK installing it setting environment variables and confirming everything actually works. Yes you will need admin rights once or twice. No you do not need to sacrifice a hard drive.

Pick the right JDK build

Choose a build provider such as Oracle or an OpenJDK build like Eclipse Temurin or Amazon Corretto. For most people pick a long term support build to avoid surprises in the middle of a sprint. Download the Windows x64 installer for the JDK version you want and save it somewhere you can find later.

Run the installer

Right click the downloaded installer and run as administrator. Follow the prompts. Default install locations are fine for most developers. The installer will create a JDK home folder that we will reference from environment variables later.

Set JAVA_HOME environment variable

Open System Properties then Advanced then Environment Variables. Create a new user or system variable named JAVA_HOME and set the value to the JDK home folder path. For example C\Program Files\Java\jdk-17. Using JAVA_HOME avoids hard coding full paths inside scripts and keeps life sane.

Add the JDK bin folder to PATH

Edit the PATH variable and add %JAVA_HOME%\bin near the front so java and javac run from your chosen JDK. Save and close the dialog. Restart any open Command Prompt or PowerShell windows so they pick up the change.

Why put %JAVA_HOME%\bin at the front

Windows resolves executables by scanning PATH from left to right. Placing your JDK near the front ensures your tools use the JDK you just installed rather than an ancient Java from whatever random app installed years ago.

Verify the installation

Open a new Command Prompt or PowerShell window and run the following commands to confirm both the runtime and compiler are correct.

  • java -version
  • javac -version

Both commands should show the installed JDK version. If a different version appears run where java and where javac to see which executables are being found and adjust PATH order or uninstall the other JDK.

Troubleshooting and practical tips

  • Prefer OpenJDK builds such as Temurin for simpler licensing and fewer surprises.
  • Keep JAVA_HOME pointed at a single JDK to avoid confusion. If you must use multiple JDKs use explicit paths in scripts or CI to be clear.
  • If you still get the wrong version check for other Java installs that may have modified PATH or system variables.
  • On Windows use where java to locate which java executable is being used and adjust PATH accordingly.
  • Restart terminals and IDEs after changing environment variables so they pick up the new values.

This guide covered downloading a JDK running the installer setting JAVA_HOME updating PATH and verifying command line tools. Follow these steps and your Windows machine will be ready to compile and run Java programs and to play nicely with IDEs and build tools. If anything goes sideways come back here and read it again while you drink something strong.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.