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

Viewed 1841

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

2 Answers

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

I uninstalled the old version of java , and made sure that directory doesnt exist anymore . Installed new version, updated the path variables , rebooted machine but still facing this issue

Related