Mohamed Boussaa
2015-12-22 15:44:04 UTC
I am running this command on my mac terminal :
ssh -t -o "ProxyCommand ssh ***@10.0.0.1 nc %h %p 22" ***@10.0.0.22 "ls -l"
It works. But when I run it like below in eclipse:
List<String> result = new ArrayList<String>();
java.lang.Process pp;
try {
pp = Runtime.getRuntime().exec("ssh -t -o ProxyCommand ssh
***@10.0.0.1 nc %h %p 22 ***@10.0.0.22 ls -l");
pp.waitFor();
BufferedReader br = new BufferedReader(new
InputStreamReader(pp.getInputStream()));
String line = "";
while ((line = br.readLine()) != null) {
System.out.println("line :"+line);
result.add(line);
}
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
It doest not work and does not print any thing on the console.
Do you have an idea ?
------------------------------------------------------------------------------
ssh -t -o "ProxyCommand ssh ***@10.0.0.1 nc %h %p 22" ***@10.0.0.22 "ls -l"
It works. But when I run it like below in eclipse:
List<String> result = new ArrayList<String>();
java.lang.Process pp;
try {
pp = Runtime.getRuntime().exec("ssh -t -o ProxyCommand ssh
***@10.0.0.1 nc %h %p 22 ***@10.0.0.22 ls -l");
pp.waitFor();
BufferedReader br = new BufferedReader(new
InputStreamReader(pp.getInputStream()));
String line = "";
while ((line = br.readLine()) != null) {
System.out.println("line :"+line);
result.add(line);
}
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
It doest not work and does not print any thing on the console.
Do you have an idea ?
------------------------------------------------------------------------------