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?