Last active
June 5, 2020 22:24
-
-
Save josephworks/eecfc32aef24d3d44a35aa359c7d50e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Today = (Get-Date).DateTime | |
$javaversion = (java -version) -join "`n"; | |
$intentversion = "java version ""1.8.0_231""`r`nJava(TM) SE Runtime Environment (build 1.8.0_231-b11)`r`nJava HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)" | |
$adoptversion = "openjdk version ""1.8.0_252""`r`nOpenJDK Runtime Environment (build 1.8.0_252-b09)`r`nEclipse OpenJ9 VM (build openj9-0.20.0, JRE 1.8.0 Linux amd64-64-Bit Compressed References 20200416_608 (JIT enabled, AOT enabled)`r`nOpenJ9 - 05fa2d361`r`nOMR - d4365f371`r`nJCL - cfa47e66cd5 based on jdk8u252-b09)" | |
#clear | |
function Write-ColorOutput($ForegroundColor) { | |
# save the current color | |
$fc = $host.UI.RawUI.ForegroundColor | |
# set the new color | |
$host.UI.RawUI.ForegroundColor = $ForegroundColor | |
# output | |
if ($args) { | |
Write-Output $args | |
} | |
else { | |
$input | Write-Output | |
} | |
# restore the original color | |
$host.UI.RawUI.ForegroundColor = $fc | |
} | |
Write-Output $Today | |
if ($intentversion = $javaversion) { | |
Write-ColorOutput lightgreen ($javaversion) | |
Write-ColorOutput lightgreen ("You are using the supported java version!!!") | |
} | |
elseif ($adoptversion = $javaversion) { | |
Write-ColorOutput blue ($javaversion) | |
Write-ColorOutput lightblue ("You are using the proper java version for linux and/or developers!!!") | |
Write-ColorOutput lightblue ("Consider using https://intent.store/download-jdk if possible.") | |
} | |
else { | |
Write-ColorOutput red ($javaversion) | |
Write-ColorOutput red ("You are not using a supported java version!!!") | |
Write-ColorOutput yellow ("Please download a supported version from https://intent.store/download-jdk") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment