Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top