skip to Main Content
richard@linux-mint:~$ flutter doctor -v
[✓] Flutter (Channel stable, 3.24.5, on Linux Mint 22 6.8.0-38-generic, locale
    en_US.UTF-8)
    • Flutter version 3.24.5 on channel stable at
      /home/richard/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision dec2ee5c1f (2 weeks ago), 2024-11-13 11:13:06 -0800
    • Engine revision a18df97ca5
    • Dart version 3.5.4
    • DevTools version 2.37.3

[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /usr/lib/Android/Sdk
    • Platform android-Baklava, build-tools 35.0.0
    • Java binary at: /usr/lib/jvm/jdk-21.0.5-oracle-x64/bin/javac/bin/java
    ✗ Cannot execute /usr/lib/jvm/jdk-21.0.5-oracle-x64/bin/javac/bin/java to
      determine the version

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[✓] Android Studio (version 2024.2)
    • Android Studio at /usr/lib/android-studio
    • Flutter plugin version 82.1.3
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /usr/lib/android-studio
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)

[✓] VS Code (version 1.95.3)
    • VS Code at /usr/share/code
    • Flutter extension version 3.100.0

[✓] Connected device (3 available)
    • Pixel 3a XL (mobile) • 9ADAX0LF5K • android-arm64  • Android 12 (API 32)
    • Linux (desktop)      • linux      • linux-x64      • Linux Mint 22
      6.8.0-38-generic
    • Chrome (web)         • chrome     • web-javascript • Google Chrome
      131.0.6778.85

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

How do I change the path to the CORRECT one…
/usr/lib/jvm/jdk-21.0.5-oracle-x64/bin

Many solutions point to having Android Studio installed (it is) AND having Android SDK Command-line Tools (latest) installed. Command line tools IS installed, and the checkbox in Android Studio > SDK Tools dialog verifies that.

I think the PATH to Java needs modified… for some odd reason it has "/javac/bin/java" added at the end. NO IDEA where that came from!

2

Answers


  1. You can update the path

    1. Open the terminal and run the following command to edit the .bashrc file:

      nano ~/.bashrc

    2. Look for any lines that incorrectly add Java to your PATH and remove any that reference /javac/bin/java.

      export PATH=$PATH:/usr/lib/jvm/jdk-21.0.5-oracle-x64/bin

    3. Save and Reload the file

      source ~/.bashrc

    4. Run Flutter doctor again to confirm your environment

      flutter doctor -v

    N/B: If you have Android Studio installed, ensure that it is pointing to the correct JDK . https://www.geeksforgeeks.org/how-to-set-java-sdk-path-in-android-studio/

    Login or Signup to reply.
  2. The actual problem appears to be with a JAVA_PATH rather than a PATH.

    The pathname

    /usr/lib/jvm/jdk-21.0.5-oracle-x64/bin/javac/bin/java
    

    was most likely arrived at by appending

    bin/java
    

    to

    /usr/lib/jvm/jdk-21.0.5-oracle-x64/bin/javac
    

    … on the assumption that

    /usr/lib/jvm/jdk-21.0.5-oracle-x64/bin/javac 
    

    is a proper JAVA_PATH. But it isn’t! The correct JAVA_PATH for your Java 21 installation is:

    /usr/lib/jvm/jdk-21.0.5-oracle-x64
    

    So you need to look at the effective setting of JAVA_PATH in the shell where you are running flutter doctor -v; e.g. run echo $JAVA_PATH. And figure our where you set it (incorrectly) and fix it.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search