Getting Started

Let’s walk through the steps required to use Javascript in your MicroEJ application:

mmm init -Dskeleton.module=firmware-singleapp -Dskeleton.rev=1.1.12 -Dproject.module=myproject -Dproject.rev=1.0.0

Adapt the properties values to your need. See the MMM CLI init command documentation for more details.

Javascript is supported in the following Module Natures page: - Add-On Library, - Standalone Application, - Sandboxed Application.

  • add the js dependency in the build file:
  • add the following lines in your application main class:
import com.microej.js.JsErrorWrapper;
import com.microej.js.JsCode;
import com.microej.js.JsRuntime;


  • create a file named hello.js in the folder src/main/js with the following content:
function hello() {
    var message = "MicroEJ Javascript application!";
    print("My first", message);

  • follow the steps described in the run command documentation
  • in a terminal, go to the folder containing the module.ivy file and build the project with the command:
mmm build

You should see the following message at the end of the build:


Total time: 20 seconds
  • now that your application is built, you can run it in the simulator with the command:
mmm run

You should see the following output:

My first  MicroEJ Javascript application!

You can now go further by exploring the capabilities of the MicroEJ Javascript engine and discovering the commands available in the CLI.