I have a Jenkins Server running on Windows Server 2012 and Java prompted me to update to a newer version (jre1.8.0_261 to jre1.8.0_271) and during that install it asked to uninstall older versions (for security reasons) which I allowed it to do. When I restarted Jenkins service it failed to restart. Error log indicates this Informational message:
Starting C:\Program Files\Java\jre1.8.0_261\\bin\java.exe -Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "C:\Program Files\Jenkins\jenkins.war" --httpPort=8080 --webroot="C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\war"
And this error:
Service cannot be started. System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at winsw.Util.ProcessHelper.StartProcessAndCallbackForExit(Process processToStart, String executable, String arguments, Dictionary2 envVars, String workingDirectory, Nullable1 priority, ProcessCompletionCallback callback, Boolean redirectStdin, LogHandler logHandler, Boolean hideWindow) at winsw.WrapperService.StartProcess(Process processToStart, String arguments, String executable, LogHandler logHandler, Boolean redirectStdin) at winsw.WrapperService.OnStart(String[] args) at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
The informational message gave me a clue to the problem: Jenkins is pointing to the older version of Java location here: C:\Program Files\Java\jre1.8.0_261
However the folder is empty, most importantly there is no bin folder present (no doubt due to the aforementioned uninstall).
The newer version here has the full java binaries: C:\Program Files\Java\jre1.8.0_271
How do you get Jenkins to point to the new JRE?