How to you use a specific version of Java in Azure Devops Agent without downloading?

You can now also use the JavaToolInstaller task to activate one of the pre-installed Java versions, e.g.

- task: JavaToolInstaller@0
  inputs:
    versionSpec: '11'
    jdkArchitectureOption: 'x64'
    jdkSourceOption: 'PreInstalled'

See documentation at:
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/java-tool-installer?view=azure-devops

It will also set JAVA_HOME and prepend the PATH, see source:
https://github.com/microsoft/azure-pipelines-tasks/blob/46cca412451ac4418d6332114fca8ef8c3095de1/Tasks/JavaToolInstallerV0/javatoolinstaller.ts#L80

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)