1
1
2
2
param (
3
- [Parameter (Mandatory = $true )]
4
- $JdkVersion
5
- )
3
+ [Parameter (Mandatory = $true )]
4
+ $JdkVersion
5
+ )
6
6
7
7
$ErrorActionPreference = ' Stop'
8
8
$ProgressPreference = ' SilentlyContinue' # Workaround PowerShell/PowerShell#2138
9
9
10
10
Set-StrictMode - Version 1
11
11
12
12
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.'
14
14
}
15
15
16
16
$repoRoot = Resolve-Path " $PSScriptRoot /../.."
@@ -26,10 +26,11 @@ Write-Host "Installing JDK to $env:JAVA_HOME"
26
26
Move-Item " $tempDir /jdk/jdk-${jdkVersion} " $env: JAVA_HOME
27
27
Write-Host " Done installing JDK to $env: JAVA_HOME "
28
28
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 "
33
36
}
34
-
35
-
0 commit comments