Link to home
Start Free TrialLog in
Avatar of kerzner
kerznerFlag for United States of America

asked on

How to I run a small Telnet script in Linux from Java and get back the result?

Thank you
Avatar of kyleb84
kyleb84
Flag of Australia image

You want to connect to somewhere via Telnet, but the Telnet client is in Java?
You want this to be a non-interactive procedure?

You'll need a java Telnet client, there's plenty around - then you need to gut it and take out the Telnet protocol handling.

Then you'll need to add on to that class providing automated read/write functions for your application.

It's a fair bit of work but possible.

For a start, here's a Telnet/SSH client in java, source code available.

http://javassh.org/space/start

ASKER CERTIFIED SOLUTION
Avatar of basav_com
basav_com
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kerzner

ASKER

kyleb84, the reason I am going this way is because Telnet, when I use it standalone, did work properly. My Java code did not. So I plan to wrap the use of Telnet. I will try your approach if ExpectJ does not work out.
Avatar of kerzner

ASKER

basav_com,

it sounds like what I need, and I will use it first thing tonight. I vaguely remember having used Unix expect with good results.