nr.iras.sk
nr.iras.sk

Reputation: 8488

Hide Putty terminal while running from Java

I am running the following code in Java for running a shell script in Ubuntu. But when it is running, y=the putty terminal will be displayed. But i dont want this. How will I hide this terminal.

ProcessBuilder pb = new ProcessBuilder(winBasePath + "putty.exe", "-ssh", "-m", winBasePath + "runHiveCmd.txt", linuxSystem, "-pw", linuxPwd);      
Process p = pb.start();     
try {
   p.waitFor();
} catch (InterruptedException e) {
   e.printStackTrace();
}

Upvotes: 0

Views: 488

Answers (2)

Jayan
Jayan

Reputation: 18459

If performing a remote command via ssh, consider jsch. This provides cleaner integration does not require ProcessBuilder. Here is an example you could start with

Upvotes: 1

Reimeus
Reimeus

Reputation: 159754

Try this

ProcessBuilder pb = 
  new ProcessBuilder("cmd.exe", "/C", "START", "/MIN", winBasePath + "putty.exe", ...);

Upvotes: 2

Related Questions