Hi. New guy here.
I've recently embarked on a (possibly foolish) mission to learn Java by porting a suite of scripts from Perl, starting with one that does non-interactive SFTP. I'm not wholly unprepared for this journey, as I've programmed in a variety of other languages, but the (ahem) limited documentation of jsch has me somewhat stymied.
The general flow of my program goes like this:
* Establish connection using login information held in environment variables (userid, hostname, password) [getting via java.util.Properties].
* Automatically accept host key (or not) based on boolean parameter. Throw exception if accept=false and key not known.
* Execute get or put for named file.
Simple, right? Maybe. It's not obvious to me from reading the examples where the acceptance of the host key happens. I've hacked the session connection enough that I think establishing the connection will work, but I've got to get the whole session established (host key and all) before I can test, as there's no interactivity.
Can anyone help? Has anyone else here done something similar? Code snippets are appreciated.