TEAMCITY ERROR : Unable to find java executable at: C:\Program Files (x86)\Java\jre1.8.0_102\bin\java.exe
[17:50:28][Step 1/1] Initial MAVEN_OPTS not set
[17:50:28][Step 1/1] Current MAVEN_OPTS not set
[17:50:28][Step 1/1] Unable to find java executable at: C:\Program Files (x86)\Java\jre1.8.0_102\bin\java.exe
[17:50:28][Step 1/1] jetbrains.buildServer.agent.runner.CannotBuildCommandLineException: Unable to find java executable at: C:\Program Files (x86)\Java\jre1.8.0_102\bin\java.exe at jetbrains.buildServer.agent.runner.JavaCommandLineBuilder.buildPath2Java(JavaCommandLineBuilder.java:223) at jetbrains.buildServer.agent.runner.JavaCommandLineBuilder.build(JavaCommandLineBuilder.java:175) at jetbrains.maven.MavenBuildService.createCommandLine(MavenBuildService.java:453) at jetbrains.maven.MavenBuildService.makeProgramCommandLine(MavenBuildService.java:412) at jetbrains.buildServer.agent.runner2.GenericCommandLineBuildProcess.executeProcess(GenericCommandLineBuildProcess.java:79) at jetbrains.buildServer.agent.runner2.GenericCommandLineBuildProcess.waitFor(GenericCommandLineBuildProcess.java:269) at jetbrains.buildServer.agent.impl.buildStages.runnerStages.start.CallRunnerStage.doBuildStage(CallRunnerStage.java:75) at jetbrains.buildServer.agent.impl.buildStages.RunnerStagesExecutor$1.callStage(RunnerStagesExecutor.java:25) at jetbrains.buildServer.agent.impl.buildStages.RunnerStagesExecutor$1.callStage(RunnerStagesExecutor.java:18) at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.callRunStage(StagesExecutor.java:78) at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.doStages(StagesExecutor.java:37) at jetbrains.buildServer.agent.impl.buildStages.RunnerStagesExecutor.doStages(RunnerStagesExecutor.java:18) at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.RunnerContextExecutor.callRunnerStages(RunnerContextExecutor.java:43) at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.StepExecutor.processNextStep(StepExecutor.java:25) at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.ForEachBuildRunnerStage.executeRunnerStep(ForEachBuildRunnerStage.java:138) at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.ForEachBuildRunnerStage.runStep(ForEachBuildRunnerStage.java:123) at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.ForEachBuildRunnerStage.executeBuildRunners(ForEachBuildRunnerStage.java:83) at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.ForEachBuildRunnerStage.doBuildStage(ForEachBuildRunnerStage.java:44) at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor$1.callStage(BuildStagesExecutor.java:31) at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor$1.callStage(BuildStagesExecutor.java:24) at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.callRunStage(StagesExecutor.java:78) at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.doStages(StagesExecutor.java:37) at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor.doStages(BuildStagesExecutor.java:24) at jetbrains.buildServer.agent.impl.BuildRunActionImpl.doStages(BuildRunActionImpl.java:75) at jetbrains.buildServer.agent.impl.BuildRunActionImpl.runBuild(BuildRunActionImpl.java:55) at jetbrains.buildServer.agent.impl.BuildAgentImpl.doActualBuild(BuildAgentImpl.java:295) at jetbrains.buildServer.agent.impl.BuildAgentImpl.access$100(BuildAgentImpl.java:53) at jetbrains.buildServer.agent.impl.BuildAgentImpl$1.run(BuildAgentImpl.java:259) at java.lang.Thread.run(Thread.java:745)
[17:50:28][Step 1/1] Step Build (Maven) failed with unexpected error
[17:50:28]Publishing internal artifacts
[17:50:28]Build finished
Please sign in to leave a comment.
I have this same problem, even after setting this in the agent's build properties:
env.TEAMCITY_JRE=C\:\\Program Files\\AdoptOpenJDK\\jdk-11.0.4.11-hotspot
my specific error is:
jetbrains.buildServer.agent.runner.CannotBuildCommandLineException: Unable to find java executable at: C:\Program Files\Java\jdk-11.0.2+9\bin\java.exe
But *at no time* has any Oracle JDK or any JDK been installed on this machine, and certainly not at that location. Why the heck is the TeamCity agent looking there? I tried setting env.JAVA_HOME, no dice. If I just open a terminal and run the same command that teamcity runs it worked. I've installed TeamCity as a service under the local system account. I find the TeamCity agent documentation very hard to follow, and these error messages aren't helpful.