Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

scProcess = Runtime.getRuntime().exec( "Telnet 147.27.23.1");

807591May 7 2008 — edited May 7 2008
Hello All,
I am trying to run telnet process from windows platform as follows

scProcess = Runtime.+getRuntime+().exec( "telnet 147.27.23.1");
Objective:*
My intention is to create a telnet connection to remote server, get the Input, Output and Error Stream of the process and run many unix commands on the session opened.
This all I want to do through code itself and then get the output of the command from streams.
Tried:*
However whenever I tried above, I always get process Exit value = -1.

I tried doing


scProcess = Runtime.+getRuntime+().exec( "cmd /c telnet 147.27.23.1");


which is also failing.
And
scProcess = Runtime.+getRuntime+().exec( "cmd /c start telnet 147.27.23.1"); which actually opens interactive telnet window, which is not my objective is.

Any suggestions on my objective? Is there any other way to do telnet from code?

Thanks in advance.

With Best Regards,
Aditya.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 4 2008
Added on May 7 2008
7 comments
873 views