I try using this code:

File wd = new File("/sx04a1/jakarta-tomcat-5/webapps/maltixa");
String sscp = "scp /sx04a1/jakarta-tomcat-5/webapps/maltixa/index.jsp  
p = Runtime.getRuntime().exec(sscp,null,wd);
try {
        catch (InterruptedException e) {
out.println("Exit value: " + p.exitValue());
BufferedReader reader =new BufferedReader(new  
String s = reader.readLine();
out.println("scp said [ " + s + " ]");

But the result is:
Exit value: 1 scp said [ null ]

I try with
String sscp = "scp index.jsp index4.jsp";
and the result is ok

I try too executing in a shell:
scp /sx04a1/jakarta-tomcat-5/webapps/maltixa/index.jsp
and the result is ok

I try giving all the permissions to the directory, and execute de .jsp
drwxrwxrwx 6 jipbekok jirxuxen 3072 Nov 24 11:59 maltixa
But the result is:
Exit value: 1 scp said [ null ]

Thanks for any comment

My first suggestion would be do not this task inside a JSP. JSPs are only for making your user interface, the processing i. e. your "scp" should be inside a Java class.
Second suggestion is instead of

scp /sx04a1/jakarta-tomcat-5/webapps/maltixa/index.jsp jipbekok@fff04.ff.ff.es:/sx04a1/jaka...ixa/index5.jsp [/code]

give it the absolute path of the "scp" binary on your system like this :-

/usr/bin/scp /sx04a1/jakarta-tomcat-5/webapps/maltixa/index.jsp jipbekok@fff04.ff.ff.es:/sx04a1/jaka...ixa/index5.jsp[/code]

True, do not do this from a JSP.

If you feel you absolutely must do this (regardless of whether you do it from a JSP or not, and, again, you shouldn't do this from a JSP), check out JSch from JCraft (www.jcraft.com). It is a (nearly) complete implementation of SSH2 protocol as a Java API.

Also, why are you attempting to copy JSP's around? This seems to me, to be a hacked way of attempting to implement a distributed/clustered/HA application. If so, look into admin tools that are designed to do this (and they won't be executed from the application itself).

I want to execute some tcsh script and perl programs into jsp
When I execute them in my tcsh sesion, they work well, but when i try to execute them into jsp, they do not work well
So I am trying to copy a file to my sesion folder, and execute all the scripts using ssh. Then return the result using scp. And finally show the result.
I know that it is not the way to work. I execute all the script using shell into tomcat sesion and my administrator tell me that the scripts works well. So I am very very lost.
My first code was:

p = Runtime.getRuntime().exec("/sx04a1/jakarta-tomcat-5/webapps/maltixa/maltixa.sh 1295.txt");

But now i am trying this:

p1 = Runtime.getRuntime().exec("ssh jipbekok@04.ff.fff.es /sc01a4/users/jipbekok/maltixa.sh 1295.txt",null,null);

Any suggestion is wellcome

Thanks, stephen84s
I try with /bin/scp ( the path in my server host), but it does not work.
Any suggestion?

Like I said, try JSch.

Finally it works

p1 = Runtime.getRuntime().exec("/sx04a1/jakarta-tomcat-5/webapps/maltixa/maltixa.sh ./"+numAleatorio+".txt",null,new File("/sx04a1/jakarta-tomcat-5/webapps/maltixa"));

The problem was Runtime.getRuntime().exec need the path (for the program) and if the program needs a file parameter, the file name need ./filename

Thanks for all