Azure DevOps JavaToolInstaller Error/Issue with JDK versions

Trying to implement a pipeline with Azure DevOps for springboot maven 4.0 on jdk17.
There is an issue where the pipeline is incompatible with one of the bash commands as it wants to run jdk11.
I am trying to use JavaToolInstaller to update the system to jdk17, but get an error saying the plugin is unsupported even with code to install it.

.yml code

trigger:
  - master

pool:
  vmImage: 'ubuntu-latest'

steps:
  - task: Bash@3
    inputs:
      targetType: 'inline'
      script: |
        # Install Java 17 manually
        sudo apt-get update
        sudo apt-get install -y openjdk-17-jdk
        
        # Verify Java version
        java -version

  - task: Maven@4
    inputs:
      mavenPomFile: 'pom.xml'
      mavenOptions: '-Xmx1024m'
      javaHomeOption: 'Path'
      jdkDirectory: '/usr/lib/jvm/java-17-openjdk-amd64'
      goals: 'clean package'

  # Copy JAR files to the staging directory
  - task: CopyFiles@2
    inputs:
      contents: '**/target/*.jar'
      targetFolder: '$(Build.ArtifactStagingDirectory)'

  # Publish build artifacts
  - task: PublishBuildArtifacts@1
    inputs:
      pathToPublish: '$(Build.ArtifactStagingDirectory)'
      artifactName: 'drop'

  # Run the Spring Boot application
  - task: Bash@3
    inputs:
      targetType: 'inline'
      script: |
        # Verify Java 17 is being used
        java -version

        echo "Listing files in target directory:"
        ls -al $(Build.ArtifactStagingDirectory)/target

        echo "Running the Spring Boot application..."
        java -jar $(Build.ArtifactStagingDirectory)/target/ASD-0.0.1-SNAPSHOT.jar

Bash Error:

Starting: Bash
==============================================================================
Task         : Bash
Description  : Run a Bash script on macOS, Linux, or Windows
Version      : 3.244.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
==============================================================================
Generating script.
========================== Starting Command Output ===========================
/usr/bin/bash /home/vsts/work/_temp/96124f0c-8298-4b37-815e-c653e4b5db03.sh
openjdk version "11.0.24" 2024-07-16
OpenJDK Runtime Environment Temurin-11.0.24+8 (build 11.0.24+8)
OpenJDK 64-Bit Server VM Temurin-11.0.24+8 (build 11.0.24+8, mixed mode)
Listing files in target directory:
total 32756
drwxr-xr-x 2 vsts docker     4096 Sep  5 12:23 .
drwxr-xr-x 3 vsts docker     4096 Sep  5 12:23 ..
-rw-r--r-- 1 vsts docker 33533344 Sep  5 12:23 ASD-0.0.1-SNAPSHOT.jar
Running the Spring Boot application...
Error: LinkageError occurred while loading main class org.springframework.boot.loader.launch.JarLauncher
    java.lang.UnsupportedClassVersionError: org/springframework/boot/loader/launch/JarLauncher has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

##[error]Bash exited with code '1'.
Finishing: Bash

JavaToolInstaller error:

Starting: JavaToolInstaller
==============================================================================
Task         : Java tool installer
Description  : Acquire a specific version of Java from a user-supplied Azure blob or the tool cache and sets JAVA_HOME
Version      : 0.245.3
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/tool/java-tool-installer
==============================================================================
Cleaning destination folder before extraction: /home/vsts/work/1/s
Retrieving the JDK from local path.
##[error]Specified JDK source file does not have a supported file extension.
##[error]Specified JDK source file does not have a supported file extension.
Finishing: JavaToolInstaller

I have tried a few implementations to update the system already, but the Java Version print after the update indicated no change.

1

Both Java 11 and Java 17 are pre-installed into the ubuntu-latest build agent:

This means you can use the JavaToolInstaller@0 using the jdkSourceOption: 'PreInstalled' as follows:

trigger: none

pool:
  vmImage: 'ubuntu-latest'

steps:
  - checkout: none

  - task: JavaToolInstaller@0
    displayName: 'Install Java 17'
    inputs:
      versionSpec: '17'
      jdkArchitectureOption: 'x64'
      jdkSourceOption: 'PreInstalled'
  
  - script: |
      java -version
    displayName: 'Check Java 17 version'

  - task: JavaToolInstaller@0
    displayName: 'Install Java 11'
    inputs:
      versionSpec: '11'
      jdkArchitectureOption: 'x64'
      jdkSourceOption: 'PreInstalled'
  
  - script: |
      java -version
    displayName: 'Check Java 11 version'

Running the pipeline:

Logs regarding the Java 11 tasks are similar.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật