I am trying to run a powershell command in eclipse with the following code. The powershell script display the list of installed application on windows. The script works fine when it is executed in powershell. But I am unable to get the output on the console. Could someone please tell me what is the problem here?
import com.profesorfalken.jpowershell.PowerShell;
import com.profesorfalken.jpowershell.PowerShellNotAvailableException;
import com.profesorfalken.jpowershell.PowerShellResponse;
public class TestProcessList {
public static void main(String[] args) throws Exception {
try {
PowerShell powerShell = PowerShell.openSession();
String command = "Get-ItemProperty " +
"HKLM:/Software/Wow6432Node/Microsoft/Windows/CurrentVersion/Uninstall/* " +
"| Select-Object DisplayName, DisplayVersion, Publisher, InstallDate " +
"| Format-Table –AutoSize";
PowerShellResponse response = powerShell.executeCommand(command);
System.out.println("Proceses are:" + response.getCommandOutput());
powerShell.close();
} catch (PowerShellNotAvailableException ex) {
throw new RuntimeException("Failed to run PowerShell", ex);
}
}
}