function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ameer Shaik 8Ameer Shaik 8 

Sfdx: scanner throwing this error after I have uninstalled java 8 and installed java 11

'Could not fetch Java version from path C:\Program Files\Java\jdk1.8.0_333. Reason: spawn C:\Program Files\Java\jdk1.8.0_333\bin\java ENOENT'

I have set the environment variable to jdk11 path, and I am able to run the java files but not sfdx scanner.

Any help would be really appreciated.

Thanks in advance.
Prateek Prasoon 25Prateek Prasoon 25

It looks like the SFDX scanner is still trying to use the Java version located at "C:\Program Files\Java\jdk1.8.0_333" even though you have updated your environment variables to point to the Java 11 version.
One solution you could try is to update the system path to remove any references to the old Java version. Here's how you can do this:
Open the Start menu and search for "Environment Variables".
Click on "Edit the system environment variables".
In the System Properties window, click on the "Environment Variables" button.
Under "System Variables", look for the "Path" variable and select it.
Click on "Edit".
Remove any references to the old Java version (i.e. "C:\Program Files\Java\jdk1.8.0_333\bin").
Add the path to the Java 11 version (i.e. "C:\Program Files\Java\jdk-11\bin").
Click "OK" to close all windows.
After making these changes, try running the SFDX scanner again and see if the issue is resolved.

If you find this answer helpful, Please mark it as the best answer.

Ameer Shaik 8Ameer Shaik 8
Thanks for the response Prateek, But I am still getting the same error after updating the Environment Variables and System Path.