I installed a different jdk before so .gradle library was throwimg errors . I installed jdk multiple times before uninstalling. I am struggling because my environment variable of JAVA_HOME is not getting changed its stuck to that same path the old one

PS D:\flutter_test2> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.27.3, on Microsoft Windows [Version 10.0.22631.4751], locale en-IN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
** X Cannot execute C:\Users\yashb\AppData\Local\Programs\Eclipse Adoptium\jdk-17-hotspot.\bin\java to determine the version**
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2022 17.10.5)
[√] Android Studio (version 2024.2)
[√] VS Code (version 1.96.4)
[√] Connected device (3 available)
[√] Network resources

! Doctor found issues in 1 category.

Before also there were issues in android tool chain but when camera and ml kit functionality were used it used to throw error. please this android tool chain problem is not getting solved . I tried every damn thing. Can someone please help me with this java.executable which doesn’t go. Later I figured Android studio will take care no need to have java explicitly but cant figure out anything now.

You could use the flutter config --jdk-dir option to tell Flutter the location of the JDK.

If you do flutter config --help you’ll see all the options and syntax. Give that a try. If that doesn’t work, you might need to look through your environment variables to see what it’s set to.

I tried that already. But still not working.

Open folder /android in project with Android studio.
Setting → Build tools → Select JDK.


File → Project stricture → Select gradle version compatible JDK.

Finally, gradle sync.
Good luck

Hii,
Thanks it got solved…trying regedit, restarted , uninstalled my explicit jdk and redirected in android sdk and set the path again and then used config cmd it worked…tysm

The path was edited multiple times but somehow flutter was unable to get that so needed to do some manual adjustments of jdr and then reconfigured at end.