I'm trying to run a jar file which sends a mail, using this command:
java -jar sendmail.jar
When I run the code from NetBeans everything works fine, but when I export to a jar file and run the jar file I get the following error:
Error Sending mailjavax.mail.MessagingException: Could not connect to SMTP host:
smtp.<xxx>.com, port: 25;
nested exception is:
java.net.SocketException: Permission denied: connect
After I got the error I executed the code from NetBeans, and the mail was sent. Thus I don't have any issue with SMTP or connection.
I think that the jar file cannot locate the mail.jar. Please advise.