Well, on Linux that depends on which MTA you have installed. There are quite a few choices I think, sendmail/postfix etc etc. Commonly sendmail is installed for the local user to run from the commandline. Here's an example of using that...
( echo "To: Me <email@example.com>" echo "From: You <firstname.lastname@example.org>" echo "Subject: Here's the file I really wanted to send you" echo cat the_file_you_wanted_to_send )> /usr/lib/sendmail -t
So basically here, you are using cat to print the file you wanted to send to the screen, this is redirected to the sendmail program
The -t option on sendmail is to "read message for recipients" so it parses the To/From/ lines for that info. You don't have to use it in that fashion of course, you can specify all those things on the commandline.
I have no java certifications. This makes me a bad programmer. Ignore my post.