SSH library for Java
The Java Secure Channel (JSCH) is a very popular library, used by maven, ant and eclipse. It is open source with a BSD style license.
Java - Open SSH client and send command
You can try to add for your command the "-m" and a file with secondCommand.
For more read about enter link description here
SSH Java-library for Android?
You are searching for JSch.
Other libs are jaramiko, paramiko, trilead-ssh2 . A place where you can browse the source for trilead is the connectbot project. Please notice that connectbot also uses this unmaintained lib.
It also exists a commercial SSH Java lib: J2SSH Maverick
Note: Answer refactored due to comment.
Java Telnet and SSH library
Why do you need one library for both?!
SSH:
http://www.jcraft.com/jsch/
Telnet:
http://commons.apache.org/proper/commons-net/
java ssh library that supports keys generated by putty
You will have to convert the keys to OpenSSH format: How to convert SSH keypairs generated using PuttyGen(Windows) into key-pairs used by ssh-agent and KeyChain(Linux)
Related Topics
How to Implement a Tree Data-Structure in Java
Recursively List Files in Java
What Do ^ and $ Mean in a Regular Expression
String Is Immutable. What Exactly Is the Meaning
How to Update a Jfreechart'S Appearance After It's Been Made Visible
Initialization of an Arraylist in One Line
How to Use Different Certificates on Specific Connections
Quality of Image After Resize Very Low - Java
Do We Have Any Generic Function to Check If Page Has Completely Loaded in Selenium
What's Wrong With Using == to Compare Floats in Java
Syntax For Creating a Two-Dimensional Array in Java
Java Split on Spaces and Special Characters
What's the Best Way to Check If a String Represents an Integer in Java