}
public static void main(String[] arg) {
try {
JSch jsch = new ExtendedJSch();
String host;
int port = 22;
String inputString = JOptionPane.showInputDialog("Enter username@hostname:port",
"ogce@trestles.sdsc.edu");
String user = inputString.substring(0, inputString.indexOf('@'));
if (inputString.contains(":")) {
host = inputString.substring(inputString.indexOf('@') + 1, inputString.indexOf(':'));
String strPort = inputString.substring(inputString.indexOf(':') + 1);
port = Integer.parseInt(strPort);
} else {
host = inputString.substring(inputString.indexOf('@') + 1);
}
Session session = jsch.getSession(user, host, port);
HostKey hostKey = session.getHostKey();
java.util.Properties config = new java.util.Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);