Skip to main content
Version: v11.4.3

Using 3rd party jar files

You can import external JAR files and use them in your apps, just like how you would use a Java Service written in your app. Following are the steps to incorporate an external jar file:

  1. From Developer Utilities, access File Explorer

  1. Import Resource, and select the Lib folder to place the jar file to be imported. As an example, we are using a mail file.

  1. Add the import statements for the required classes in your Java Service file. In this example, we have used the mail.jar, the package details of which can be found at To use this jar file to send emails we will be using the following code in the Java Service file after adding the import statements for the required class files:
    import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public String sendEmail(String userName, String password, String toEmailAddress, String emailSubject, String emailMessage) {
try {
// Use javamail api, set parameters from file
// set the session properties
Properties props = System.getProperties();
props.put("mail.smtp.starttls.enable", "true");
props.put("", "");
props.put("mail.smtp.port", "587");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.required", "true");
Session session = Session.getDefaultInstance(props, null);

// Create email message
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(userName));

// message.addRecipient(Message.RecipientType.TO, new InternetAddress(toEmailAddress));

String[] recipientList = toEmailAddress.split(",");
InternetAddress[] recipientAddress = new InternetAddress[recipientList.length];
int counter = 0;
for (String recipient: recipientList) {
recipientAddress[counter] = new InternetAddress(recipient.trim());
message.setRecipients(Message.RecipientType.TO, recipientAddress);

message.setContent(emailMessage, "text/html");
// Send smtp message
Transport tr = session.getTransport("smtp");
tr.connect("", 587, userName, password);
tr.sendMessage(message, message.getAllRecipients());

return "Mail sent successfully.";

} catch (MessagingException e) {
return "Error in method sendEmailNotification: " + e;

  1. To invoke the Java Service create a new Variable for Java Service:

  1. The input parameters can be accessed from the Data tab and can be bound or set to static values
  2. The Java Service can be executed either
    • by setting the Update data on input change to true thus triggering whenever the input values change or
    • by triggering the Variable created for any event on a widget for example on Mouse Click event of a Button.
  3. The result from the execution of this service can be bound to any widget.