I just setup a new jenkins slave which is running Windows server 2012. I already installed jdk-8u221-windows-x64 and set Java_home, Path like below
C:\Users\Administrator>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_221\
C:\Users\Administrator>echo %PATH%
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\
Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\
Program Files\Amazon\cfn-bootstrap\;C:\Program Files\Git\cmd;C:\Program Files\Ja
va\jdk1.8.0_221\\bin;C:\maven\bin;C:\maven\bin
However,build job running in this slave always complain that:
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK
Any idea of what might be causing this?
Update Sep 11th, 2019
I configure the slave node as method 2 of Technext's suggestion
In a Job build configuration, I selected (System) in JDK option. If I choose JDK 8 update 221, this build job run successfully, but I want to use a (System) JDK which will get from environment variable in this node, so I can switch to another slave node without changing the JDK option.
However, when I remote to this server, and open command prompt, move on to workspace folder of this project, let say: C:\jenkins_slave\workspace\project01\, then type the command: mvn clean install, it run without complain about jdk or jre as run from Jenkins.