How to run Telnet Command in java?
plz anyone help me.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
How to run Telnet Command in java?
plz anyone help me.
I would think it would need
import java.net.*
Have you tried Googling the term in relation to Java? All I
know is it has something to do with Socket programming, but
you can certainly find useful information with a simple search.
Wishes Ada xx
If to Err is human - then programmers are most human of us all.
"The Analytical Engine offers a new, a vast, and a powerful language . . .
for the purposes of mankind."
— Augusta Ada Byron, Lady Lovelace (1851)
Welcome to the Forum! Please read this topic to learn how to post code correctly and other useful tips for newcomers.
You have two approaches:
1. "exec" out to a system shell to call the telnet client with all the right environment and arguments, do the work and capture the output and any return codes. (For example, if all you had to do was an automated exchange with a foreign telnet host.)
2a. Write a telnet application in Java that does what you need, and then write the client code around that.
2b. Find a telnet/ssh/scp library you can leverage, and write your client code around that.
(1) is crufty, highly system dependent, and brittle. But it can get the job done in a pinch if you need something quick and dirty. (2a) is probably over-kill. (2b) is doable, but you have to find the library for you. There used to be some non-free Java telnet/ssh libraries I used to make an ssh applet, and such things still exist for all browsers, so this implies there are more than a few telnet/ssh libraries out there you can leverage.
Final note: don't use telnet. Use ssh. Another hint: don't ever use telnet.