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
You can update the path
Open the terminal and run the following command to edit the .bashrc file:
nano ~/.bashrc
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
Save and Reload the file
source ~/.bashrc
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/
The actual problem appears to be with a
JAVA_PATH
rather than aPATH
.The pathname
was most likely arrived at by appending
to
… on the assumption that
is a proper
JAVA_PATH
. But it isn’t! The correctJAVA_PATH
for your Java 21 installation is:So you need to look at the effective setting of
JAVA_PATH
in the shell where you are runningflutter doctor -v
; e.g. runecho $JAVA_PATH
. And figure our where you set it (incorrectly) and fix it.