Skip to content

Commit 610a58f

Browse files
committed
Set JAVA take 3, list folders
1 parent 7a09000 commit 610a58f

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

eng/scripts/InstallJdk.ps1

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11

22
param(
3-
[Parameter(Mandatory = $true)]
4-
$JdkVersion
5-
)
3+
[Parameter(Mandatory = $true)]
4+
$JdkVersion
5+
)
66

77
$ErrorActionPreference = 'Stop'
88
$ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138
99

1010
Set-StrictMode -Version 1
1111

1212
if (-not $env:JAVA_HOME) {
13-
throw 'You must set the JAVA_HOME environment variable to the destination of the JDK.'
13+
throw 'You must set the JAVA_HOME environment variable to the destination of the JDK.'
1414
}
1515

1616
$repoRoot = Resolve-Path "$PSScriptRoot/../.."
@@ -26,10 +26,11 @@ Write-Host "Installing JDK to $env:JAVA_HOME"
2626
Move-Item "$tempDir/jdk/jdk-${jdkVersion}" $env:JAVA_HOME
2727
Write-Host "Done installing JDK to $env:JAVA_HOME"
2828

29-
if(-not $env:Path.Contains($env:JAVA_HOME)){
30-
Write-Host "Update PATH to include JAVA";
31-
$path = "$env:JAVA_HOME\bin;$env:Path";
32-
[System.Environment]::SetEnvironmentVariable("PATH", $path, "User");
29+
if (-not $env:Path.Contains($env:JAVA_HOME)) {
30+
Write-Host "Update PATH to include JAVA";
31+
$path = "$env:JAVA_HOME\bin;$env:Path";
32+
Get-ChildItem $env:JAVA_HOME
33+
Get-ChildItem "$env:JAVA_HOME\bin"
34+
[System.Environment]::SetEnvironmentVariable("PATH", $path, "User");
35+
Write-Host "HOST = $env:Path"
3336
}
34-
35-

0 commit comments

Comments
 (0)