0

I'm developing a Java application that uses different libraries to connect to SSH servers or to console terminals via serial port. Now halfway into the development I see that it would be really interesting to be able to replace those libraries with the PuTTY program itself. Users would enter the connection parameters (IP address, serial port, SSH keys, ...) into PuTTY as they usually do and the Java application would send the commands to PuTTY and read the output of those commands. Advantages:

  • PuTTY is very reliable and also it's what the users use when they do the process by hand so it's guaranteed that the data communication will work fine. Also they could use their current saved sessions, settings and any other configuration
  • No need to import and use different Java libraries for Telnet, SSH, serial communications, etc
  • In the case of serial port, only one program can be connected to the COM port so it's the only way that the user could send commands without closing the Java application

Is there a way to do this with PuTTY or other equivalent program?

golimar
  • 2,419
  • 1
  • 22
  • 33
  • 1
    PuTTY is a GUI application, not designed for automation. PuTTY Plink might be a better option. See [Automating command/script execution using PuTTY](https://stackoverflow.com/q/39361444/850848). Though using native Java libraries is always the best option. So if you have that done already, I'd stick with it. – Martin Prikryl Mar 04 '21 at 11:28
  • @MartinPrikryl Thanks for the advice. Still, I think that letting it get input from other app instead of keyboard, and sending the output to that app is compatible with being a GUI application, as the user would use many of the other features of PuTTY – golimar Mar 04 '21 at 14:25

0 Answers0