Search code examples
javaexectelnet

Telnet into host and execute commands


I am using the Apache commons-net lib to telnet into a PC. After I am done connecting to this server, I want to be able to execute commands on it(server). What is the best way to achieve this in Java?


Solution

  • You're better off using JSch to telnet to your remote machine and execute the commands. Checkout the examples sections - it has everything you need.