The problem: When you run flutter doctor
, you get a “no Java Development Kit (JDK) found” error:
The solution: Install a Java Development Kit, then set the environment variables
Download and install a JDK
The download link given by flutter doctor didn’t work when I tried it, but this one did.
Download the file and run the installer.
Add the JAVA_HOME environment variable and update the PATH
Now for the “fun” part: You may have to manually edit the JAVA_HOME and PATH environment variables on your Windows system. In the example below, I’m using JDK19. Please make sure to adapt the instructions so they match your particular setup.
- Locate your JDK installation directory. The default path is usually
C:\Program Files\Java\jdk-19
, but it can vary depending on your installation settings. Make sure to copy this path for later use. - Right-click on the Windows Start button and select System.
- In the System window, click on Advanced system settings:
- In the System Properties window, click on the Environment Variables button near the bottom right:
- Under System variables, click on the New button.
- Enter the variable name
JAVA_HOME
. As the variable value, enter the path to your JDK installation directory from the first step:
For example, if your JDK is installed in C:\Program Files\Java\jdk-19
, then the value should be C:\Program Files\Java\jdk-19
.
- Click OK to save the new environment variable.
- In the System Variables list, locate the Path variable, and click Edit.
- In the Edit environment variable window, click New, and add
%JAVA_HOME%\bin
to the list. This ensures that the JDK executables are available in your system’s PATH.
- Click OK to save the changes to the Path variable, and close all remaining windows by clicking OK as well.
Please keep in mind that you will need to open a new Command Prompt window for the changes to take effect, as the environment variables are loaded when the Command Prompt is launched.
To verify the changes, you can run echo %JAVA_HOME%
in a new Command Prompt window. This should display the path to your JDK installation directory. Running java -version
should display the version information of your JDK 19 installation.
Finally, running flutter doctor
should show that the “No Java Development Kit (JDK) found” error has disappeared: