Java application not sending e-mail with gmail

Suddenly my java application for sending student attendance reports threw the following exception:

sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

It turned out that my avast firewall was interfering so I would propose to all those having this problem to disable any anti-viruses or firewalls temporarily and try again.