As one of Java paradigms is "write once, run anywhere", and calling external software makes that much more complicated, you'll want to steer away from it as much as possible. However, sometimes there's really no other viable option.
The example below shows how to ping a host and capture both the standard and the error output streams.
On my email sending class, I generally have a fallback that relies on the machine sendmail/mail program. It kicks in if the SMTP server is not responding or is badly configured.