0

I have some problem about run windows cmd ,when I run my code on GEL or some java tool,it works,but it run error that windows can't find "pscp".However,I export execute jar from eclipse and java -jar ..It works!! I set pscp path first, so i can type pscp commend on cmd.

String file="test5.pdf";

String Ip="140.118.175.196";
String commend="cmd.exe /c start pscp.exe d://"+file+" admin@"+Ip+":/home/admin/test";

Process ee = Runtime.getRuntime().exec(commend);

What happen? Thanks.

MadProgrammer
  • 343,457
  • 22
  • 230
  • 366
louis
  • 25
  • 6
  • 1
    if you type pscp in the cmd prompt manually what do you get? looks like putty is not on your path – RNJ Nov 15 '13 at 09:02
  • I place my putty and pscp on C://putty/ and i can run this commend line on cmd directly. I type pscp and i can get commend option ,It seems no problem? – louis Nov 15 '13 at 09:05
  • but if you run it from c: for example does it find pscp? – RNJ Nov 15 '13 at 09:06

1 Answers1

1

pscp.exe is not in your path. You need to add it to your path or put in the command string the complete path to the pscp.exe executable.

Adrian Ber
  • 20,474
  • 12
  • 67
  • 117