gradle-6.9 detects old JAVA path even I have updated JAVA_HOME (react-native)
Asked Answered
P

1

6

I was using java from this path C:\Program Files\Java\jdk-17 and I have used gradle-6.9 at that time. Later I have installed OpenJDK and now my JAVA_HOME is C:\Program Files\Eclipse Foundation\jdk-11.0.12.7-hotspot. But now if I run gradle using gradle-6.9 version I am getting this

$ ./gradle

FAILURE: Build failed with an exception.

  • What went wrong: The supplied javaHome seems to be invalid. I cannot find the java executable. Tr
    ied location: C:\Program Files\Java\jdk-17\bin\java.exe

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

But If I am using any other gradle version for example even 6.9.1 as well everything works fine

eg: 6.9.1, 7.x

I have tried removing cache folder as well but no hope, please help

Praefect answered 17/9, 2021 at 3:2 Comment(0)
P
28

The previous java got uninstalled but the directory was still present there C:\Program Files\Java\jdk-17 Deleted it and it working fine now

Praefect answered 17/9, 2021 at 4:23 Comment(3)
you just save my life. thank you!Regime
Oh man, I wasted a whole day looking for this same solution!Scowl
Spent an hour searching for this...!! Thank you!Pellicle

© 2022 - 2024 — McMap. All rights reserved.