Flutter doctor: No Java Development Kit (JDK) found on Windows 11

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.

  1. 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.
  2. Right-click on the Windows Start button and select System.
  3. In the System window, click on Advanced system settings:
  1. In the System Properties window, click on the Environment Variables button near the bottom right:
  1. Under System variables, click on the New button.
  2. 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.

  1. Click OK to save the new environment variable.
  2. In the System Variables list, locate the Path variable, and click Edit.
  3. 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.
  1. 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:

Java: Missing key codes on non-US keyboards

Java does not seem to have key codes for several keys on non-US keyboards. This does not prevent the typed characters from being recognized, but it makes it impossible for the Robot class to simulate pressing these keys.

Examples of missing key codes

On a standard French AZERTY keyboard, 2 keys result in a key code of 0 (unknown key code): The key above the tab which generates the character “²” and the much more important ù% key.

On a German QWERTY keyboard, the ß?\ key and the äÄ,öÖ and üÜ keys are undefined.

You can confirm this using the Java KeyEventDemo:
Percentage key on AZERTY keyboard

Workaround

Use the Alt Numpad input method.

 

How to add a URL to the Java Exception Site List file

On one of our computers, the Security Tab in the Java Control Panel sometimes looks like this:
Java Control PanelAs you can see, the part required to manage the exception site list is missing/not accessible. I have no idea why (reinstalling Java did not help).

However, you can also add exceptions by directly editing the exception.sites file. Under Win 7, it is normally found in the C:\Users\*YOUR USERNAME*\AppData\LocalLow\Sun\Java\Deployment\security directory. Simply add a new line for each URL (e.g. https://stupdidbank.example.com), save the file, then restart the browser.

See this page or the official Java documentation for further information.