I am writing Powershell script, which will essentially be a menu driven utility for doing random tasks. One of the feature includes, to display java version. I am using REPLto have it in continues loop. My issue is that the Java version is just not being displayed on the screen. Can anyone please help me with the reason for this or a work around ? Below is the code:
enum Outcome
{
Continue
Quit
}
Class Opatch_Manager {
REPL() {
while($this.ShowMenu() -eq 'Continue') {
$this.Print()
}
}
Print() {
Write-Host "Test"
}
[String] ShowJava() {
java -version
}
[Outcome] ShowMenu() {
$this.ShowJava()
return [Outcome]::Quit
}
}
$obj = New-Object Opatch_Manager
$obj.REPL()