title: Using OpenJDK (Microsoft Java) in an Dev Ops Pipeline
body: <p>I am using an PowerShell command to download the latest version of OpenJDK (bits download)</p>
  <pre><code>Start-BitsTransfer -Source &quot;https://aka.ms/download-jdk/microsoft-jdk-17-windows-x64.zip&quot;
  </code></pre>
  <p>And then I am unzipping it like this :</p>
  <pre><code>Expand-Archive -Path $(Build.SourcesDirectory)/$(zipFile) -DestinationPath $(Build.SourcesDirectory)/Java
  </code></pre>
  <p>And then I am setting the Java environmental variables like this :</p>
  <pre><code>$JavaHome = '$(Build.SourcesDirectory)' + &quot;\&quot; + &quot;Java&quot; + &quot;\&quot; + &quot;jdk-17.0.2+8&quot;
  
  [System.Environment]::SetEnvironmentVariable(&quot;JAVA_HOME&quot;, $JavaHome)
  
  [System.Environment]::SetEnvironmentVariable(&quot;Path&quot;, [System.Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine) + &quot;;$($env:JAVA_HOME)\bin&quot;)
  </code></pre>
  <p>Then lastly I am using the version check in Java to see what version i am using and I get this :</p>
  <pre><code>openjdk version &quot;1.8.0_322&quot;
  OpenJDK Runtime Environment (Temurin)(build 1.8.0_322-b06)
  OpenJDK 64-Bit Server VM (Temurin)(build 25.322-b06, mixed mode)
  </code></pre>
  <p>This is not the one I downloaded, I downloaded</p>
  <pre><code>openjdk 17.0.2 2022-01-18 LTS
  </code></pre>
  <p>So I am sure within my pipeline it is using the Java that was on the machine already. So how can I make sure it is using the one I have downloaded and set the environmental variables up for. If I check on my pipeline I cannot see a JAVA PATH at all - so it must be using mine.</p>
  <p>The only reason I am using the downloaded one is so I can use the latest (LTS) when it comes available.</p>