• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Raja Mirrah
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic