aspose file tools*
The moose likes Linux / UNIX and the fly likes java.io.IOException when using Runtime.getRuntime.exec(shell_cmd) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "java.io.IOException when using Runtime.getRuntime.exec(shell_cmd)" Watch "java.io.IOException when using Runtime.getRuntime.exec(shell_cmd)" New topic
Author

java.io.IOException when using Runtime.getRuntime.exec(shell_cmd)

Raja Mirrah
Greenhorn

Joined: Jun 23, 2009
Posts: 26
Hi All,

I am getting the following exception. when running a shell command

ksh -c export TERM=vt100; ssh -p 2261 -N -f -L<local-port>:loghost:2361 IP_ADDRESS

localport will be replaced by valid port number greater than 1024.

The following are the exception which i am receiving.



java.io.IOException: SSHksh: not found
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:53)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
at java.lang.Runtime.exec(Runtime.java:591)
at java.lang.Runtime.exec(Runtime.java:464)
at PLAMConnection.startup(PLAMConnection.java:876)
at PLAMConnection.processRqst(PLAMConnection.java:120)
at PLAMConnectionMgr.worker2(PLAMConnectionMgr.java:488)
at PLAMConnectionMgr.worker(PLAMConnectionMgr.java:379)
at PLAMConnectionMgr.receive(PLAMConnectionMgr.java:302)
at PLAMListener.listen(PLAMListener.java:62)





Can anyone tell me the exact reason for this error?


Your early response is highly appreciated.


Warm Regards,
Raj
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Redirecting out- and input with > and < is a feature of your shells, but not possible from runtime.getRuntime().exec ...

And maybe more than one command, concatenated with ; is a problem?

Here is an article about pitfalls with runtime:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?


http://home.arcor.de/hirnstrom/bewerbung
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.io.IOException when using Runtime.getRuntime.exec(shell_cmd)