diff --git a/check.ps1 b/check.ps1 index d1c2d5a54b..b3432f1b50 100644 --- a/check.ps1 +++ b/check.ps1 @@ -7,7 +7,7 @@ function Check([string] $componentName, [string] $verstr, [Version] $requiredVer { $verStr = $verStr.Substring(1) } - + # Version could be a beta, like 2.1.200-preview-007576 $x = $verstr; $idxDash = $x.IndexOf('-') @@ -92,6 +92,25 @@ if (-Not $ok) { Write-Host } +# Check Java +$javaFullVersion = & "java" -version 2>&1 +$javaVersion = $javaFullVersion[0].toString().Split(' ') +$javaVersion = $javaVersion[2].Trim('"') +$underscoreIndex = $javaVersion.IndexOf('_') +$actualVersion = $javaVersion.Substring(0, $underscoreIndex) +$ok = Check "java" $actualVersion ([Version]::Parse("1.8.0")) + +if (-Not $ok) { + Write-Host " You can udpate java by downloading from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html" + Write-Host +} +$ok = Test-Path 'env:JAVA_HOME' +if (-Not $ok) { + Write-Host "JAVA_HOME Environment variable not set. Set it to JDK folder. Example c:\Program Files\Java\jdk1.8.0_171" -ForegroundColor Red + Write-Host +} + + # See here for hints on doing Devenv detection: # https://stackoverflow.com/questions/42435592/determining-installed-visual-studio-path-for-2017 # Or here: https://stackoverflow.com/questions/40694598/how-do-i-call-visual-studio-2017-rcs-version-of-msbuild-from-a-bat-file/40702534#40702534 \ No newline at end of file