我得到的Keytool路径无效,并且我也为JDK设置了环境变量。
Function Get-JavaKeytool
{
param (
[string] $JavaMinVersionRequired = "8.0.1510"
)
$RequiredVersion = New-Object System.Version($JavaMinVersionRequired)
try {
$jreVal = Find-UpdateJAVAHOME -JavaMinVersionRequired $RequiredVersion
$path = $jreVal + '\bin\keytool.exe'
if (Test-Path $path) {
$keytool_ = (Get-Command $path).Source
}
} catch {
$keytool_ = Read-Host "keytool.exe not on path. Enter path to keytool (found in JRE bin folder)"
}
if([string]::IsNullOrEmpty($keytool_) -or -not (Test-Path $keytool_)) {
throw "Keytool path was invalid."
}
return $keytool_
}