Running two versions side by side

If you have two versions of Gradle (Windows 10) running side by side - 6.4.1 and 7.0.2. When you run gradle -v I am returned 6.4.1. How do I get it to switch to 7.0.2. In my Environment Settings both are listed. Do I need to remove one (Note locked down machine hint hint).

That’s more a question to your operating system / shell.
If you do gradle -v, your shell uses the one that comes first in the PATH environment variable.
To change that, you need to change the PATH variable.
There are also tools like sdkman and similar that can switch between different Gradle versions.

But actually you shouldn’t really need that, or even need an installed Gradle version, let alone two.
Imho every project that does not have the Gradle wrapper in use has a bug.
And if the Gradle wrapper is in use, then you don’t even need to have one Gradle version installed, as the wrapper downloads the correct Gradle version for that build from the URL configured in the wrapper properties file.

@Vampire I do not disagree with any of your statements. I did change the order of the system Variable =GRADLE_HOME; Value=C:\Program Files~*7.02.7\bin; C:\Program Files~*6.4.1\bin; and restarted and no luck. I have raised this issue internally as I am working on a very locked down system. Cyber Security you got to respect policy and procedure.

Wrong variable, not GRADLE_HOME, but PATH.

@Vampire that did it with a restart. Thank you. Now on to the next problem —

  • Type ‘com.moowork.gradle.node.npm.NpmSetupTask’ property ‘args’ is missing an input or output annotation.