Java SSH Client

http://www.yegor256.com/2014/09/02/java-ssh-client.html

String hello = new Shell.Plain(
  new SSH(
    "ssh.example.com", 22,
    "yegor", "-----BEGIN RSA PRIVATE KEY-----..."
  )
).exec("echo 'Hello, world!'");

Java console program + Maven

Use “Assembler Plugin”:

http://www.mojohaus.org/appassembler/appassembler-maven-plugin/usage-program.html

How it looks:

$ mvn package appassembler:assemble
...
$ sh target/appassembler/bin/app
Hello World!