Fork me on GitHub

Create a runnable application (Jar) file for SARL application

Usually, it’s convenient to bundle many SARL entity files into a single archive file. This file is named runnable application file (a.k.a. runnable jar file in the Java community). It allows a use to run SARL entities without having to know their names and type them in a command prompt, rather the user can just double click on the runnable application file and the program will fire up. A runnable application file allows SARL entities to be loaded just like when a user clicks an regular executable file.

In this tutorial, we’re going to cover the key points for creating a runnable application file for SARL. Specifically, we’ll take a simple application and explore the ways to package and run it as a runnable file.

1. Preparing the SARL project

Before creating the runnable application file, it is necessary to have a SARL project and its associated run configuration.

1.1. SARL Project Sample

For creating a runnable application file, you must create or have a SARL project with a “main program” as it is illustrated in the following figure.

Example of SARL program

The mandatory element in your program must be the main function:

static def main(args : String[]) : void {
}

You could find a description of the method for creating your first SARL project.

1.2. SARL Application Run Configuration

Once you have implemented your SARL program, you must define a run configuration. This configuration is a feature of the SARL IDE that enables to define a method for launching the program within the SARL Eclipse IDE.

For defining the run configuration, you should follow the steps:

  1. Open the dialog box for the run configurations.

Open run configurations

  1. Create a SARL Application, as illustrated in:

Create a SARL application

2. Creating the runnable application file

To create a new runnable application file in the workbench:

Open the export wizard

Select the type of export

Fill up the export parameters

Copyright © 2014-2023 SARL.io, the Original Authors and Main Authors.

Documentation text and medias are licensed under the Creative Common CC-BY-SA-4.0; you may not use this file except in compliance with CC-BY-SA-4.0. You may obtain a copy of CC-BY-4.0.

Examples of SARL code are licensed under the Apache License, Version 2.0; you may not use this file except in compliance with the Apache License. You may obtain a copy of the Apache License.

You are free to reproduce the content of this page on copyleft websites such as Wikipedia.

Generated with the translator docs.generator 0.14.0-SNAPSHOT.