9

Is there an open source telnet API/library out there for Java (something like Python telnetlib)? I need to connect to a server using telnet and execute some commands from within a Java program.

bakkal
  • 54,350
  • 12
  • 131
  • 107
shipmaster
  • 3,994
  • 4
  • 30
  • 33

3 Answers3

10

My preference is to use the Apache Commons-Net library. http://commons.apache.org/net/ It supports many client protocols, including Telnet.

I've used this in the past and it works quite well.

Paul Kuykendall
  • 3,167
  • 1
  • 20
  • 17
  • I took your suggestion and made something [simple](http://stackoverflow.com/questions/5988029/java-telnet-library/14098926#14098926) (and EXTREMELY limited in scope) for my use... might be handy. – Boon Dec 31 '12 at 07:45
1

Maybe is worth considering using SSH protocol, instead of Telnet. Telnet is much less secure, for instance all the data is transmitted as plain text (including your passwords).

kofucii
  • 7,393
  • 12
  • 51
  • 79
  • 1
    it's a windows machine that already has a telnet server, it's also in the internal network, so no outside access (no security concerns). – shipmaster Aug 13 '10 at 21:40
0

Sure is.

http://sourceforge.net/projects/jtelnet/ (EDIT: Noted as crap.)

Here is an Apache project which is presumably much more handy:

http://commons.apache.org/net/

Teekin
  • 12,581
  • 15
  • 55
  • 67
  • Lets see, last website update in 2003, last file update in 2003, and 2 negative votes with a comment saying its very bad. I don't think so – TheLQ Aug 13 '10 at 21:28
  • 1
    Yeah, I noticed that like 3 seconds after I posted it. ;) – Teekin Aug 13 '10 at 21:31