VSTS complaining that JAVA_HOME is not set


(Stuart Johnstone) #1

Hi,

We’re trying to do a trial of sonarcloud but are having all kinds of bother getting our build agents to run the scanner.

Per subject line, we get this error despite having installed JRE, set the mentioned environment variable and rebooted. Must be missing something, anyone got any ideas what?

Thanks
Stuart

2018-10-25T11:07:39.1069761Z
2018-10-25T11:07:39.1070116Z ERROR: JAVA_HOME not found in your environment, and no Java
2018-10-25T11:07:39.1070371Z executable present in the PATH.
2018-10-25T11:07:39.1070636Z Please set the JAVA_HOME variable in your environment to match the
2018-10-25T11:07:39.1070900Z location of your Java installation, or add “java.exe” to the PATH
2018-10-25T11:07:39.1077757Z


(Fabrice Bellingard) #2

Hi Stuart,

that’s quite difficult to help you on this, since you’re saying that you’ve set the JAVA_HOME environment variable, but it’s pretty clear that the scanner does not find it when it gets executed. Maybe you set JAVA_HOME only for a specific user on your agent, and the scanner is executed with another user?


(Stuart Johnstone) #3

It seems something in our environment hadn’t been restarted - as it is working fine now.

Thanks for looking.
Stuart