Build and Run an Application

Create a MicroEJ Standalone Application

  • Create a project in your workspace. Select File > New > MicroEJ Standalone Application Project.

    New MicroEJ Standalone Application Project

    New MicroEJ Standalone Application Project

  • Fill in the application template fields, the Project name field will automatically duplicate in the following fields. Click on Finish. A template project is automatically created and ready to use, this project already contains all folders wherein developers need to put content:

    • src/main/java: Folder for future sources
    • src/main/resources: Folder for future resources (images, fonts etc.)
    • META-INF: Sandboxed Application configuration and resources
    • module.ivy: Ivy input file, dependencies description for the current project
  • Right click on the source folder src/main/java and select New > Package. Give a name: com.mycompany. Click on Finish.

    New Package

    New Package

  • The package com.mycompany is available under src/main/java folder. Right click on this package and select New > Class. Give a name: Test and check the box public static void main(String[] args). Click on Finish.

    New Class

    New Class

  • The new class has been created with an empty main() method. Fill the method body with the following lines:

    System.out.println("hello world!");
    
    MicroEJ Application Content

    MicroEJ Application Content

    The test application is now ready to be executed. See next sections.

Run on the Simulator

To run the sample project on Simulator, select it in the left panel then right-click and select Run > Run as > MicroEJ Application.

MicroEJ Development Tools Overview

MicroEJ Development Tools Overview

MicroEJ SDK console will display Launch steps messages.

=============== [ Initialization Stage ] ===============
=============== [ Launching on Simulator ] ===============
hello world!
=============== [ Completed Successfully ] ===============

SUCCESS

Run on the Hardware Device

Compile an application, connect the hardware device and deploy on it is hardware dependant. These steps are described in dedicated documentation available inside the MicroEJ Platform. This documentation is accessible from the MicroEJ Resources Center view.

Note

MicroEJ Resources Center view may have been closed. Click on Help > MicroEJ Resources Center to reopen it.

Open the menu Manual and select the documentation [hardware device] MicroEJ Platform, where [hardware device] is the name of the hardware device. This documentation features a guide to run a built-in application on MicroEJ Simulator and on hardware device.

MicroEJ Platform Guide

MicroEJ Platform Guide