79667549

Date: 2025-06-16 11:55:29
Score: 1
Natty:
Report link

I try to run an Azure pipeline to deploy a Java app with maven using self-hosted agent, but it says that agent doesn't see Java. How can I fix it?

You installed Java in user-specific folder: C:\Users\user\..., If the Azure DevOps agent is running as a Windows service, it won’t have access to C:\Users\user\.jdk\... So when your pipeline runs, it says: agent doesn't see Java, even it works fine in the command line under your user account.

To resolve use System-Wide JDK installation install java in shared ProgramFiles and set the path in System Environment Variables.

Or open C:\Users\user\.jdk in PowerShell, download and create your agent there, and run .\config.cmd. This runs the agent interactively as that user, which will have access to the .jdk Java installation.

In your azure-pipelines.yml file, you specified jdkVersionOption: '1.17', which uses Java version 17. However, you have installed Java version 23, which causes the error.

so, use below lines in your YAML file.

javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.23'
or
javaHomeOption: 'Path'
jdkDirectory: '$(JAVA_HOME)'

enter image description here

Reasons:
  • Blacklisted phrase (0.5): How can I
  • RegEx Blacklisted phrase (1.5): How can I fix it?
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
Posted by: Aslesha Kantamsetti