Since it is insecure, most servers will not have a Telnet server running. You need to check with the target server's admin before attempting this since they get kind of upset if you seem to be trying to break into their server.
You might have more luck with SSH and for that you can use a number of libraries. My preferred SSH library is JSSH from JCraft - http://www.jcraft.com/jsch/. You can get both Telnet and SSH libraries from http://javassh.org/space/start but I have very limited experience of these products. There is also a telnet client as part of "Jakarta Commons Net"; here Google is your friend.
Again, check with the server admin before trying to connect.
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
Joined: Sep 30, 2009
i write the follwing code but it just open intractive window for telnet
i want to create a telnet session from java program so that i execute commands on it like ps -ef etc
Sharjeel, UseOneThreadPerQuestion. You've already been given advice here yesterday. Right now you've wasted some of James' time; the Apache telnet client had already been mentioned (but the links are still good).