You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Pipeline中JavaToolInstaller报错:Java 11未预安装排查

问题:Azure Pipeline配置JavaToolInstaller报错,提示Java 11未预装

我使用以下YAML配置Azure Pipeline时出现报错,尽管选用的镜像已安装Java 11,请问哪里配置有误?

报错信息:

##[error]Java 11 is not preinstalled on this agent

对应的YAML配置:

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  buildConfiguration: 'Release'
  outputDirectory: '$(build.binariesDirectory)/$(buildConfiguration)'

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

解答

问题出在**jdkArchitectureOption: 'x86'**配置项上。

windows-latest镜像预装的Java 11是64位(x64)版本,你指定了32位(x86)架构,导致Agent找不到对应版本的预装JDK,因此触发报错。

解决方案:

  1. 若不需要32位Java,直接将jdkArchitectureOption的值改为x64,使用镜像预装的64位Java 11:
steps:
- task: JavaToolInstaller@0
  inputs:
    versionSpec: '11'
    jdkArchitectureOption: 'x64'
    jdkSourceOption: 'PreInstalled'
  1. 若确实需要32位Java 11,需将jdkSourceOption改为AzureStorage或LocalDirectory,手动指定32位JDK的安装源,不再依赖预装版本。

内容的提问来源于stack exchange,提问作者theDoke

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 03:27:03