键盘工具路径无效

时间:2019-07-19 12:15:06

标签: powershell

我得到的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_
}

0 个答案:

没有答案