Skip to content

Add Java to your Tap

The built-in Java Virtual Machine offers many features to improve the behavior of your Iotize device:

Why add Java byte code?

Even extremely small Java code can allow your Tap to:

  • Detect alarm conditions,

  • Format alarm messages according to the formats expected by your servers

  • Format and send data periodically (datalog)

  • Perform advanced user management (token management,...)

  • To manage external sensors via I2C (or other wired protocols, ADC,...) and make their data available in InTap variables,

  • Control inputs/outputs available on the module,

  • To manage a specific protocol via UART (or other)...

So a lot of reason to add a few lines of Java. Because complex functions are already coded natively into your modules, the in-memory cost will be very low.

Why Java?

Java has several advantages:

  • It is close to the C language, which is the standard known to developers in the embedded world.
  • It is close to the languages used in mobile applications (Android, iOS, JavaScript,...)
  • It is made efficient and secure by Iotize's JVM,
  • It is easily debuggable thanks to Raisonance's tools (Ride7 + JVM kit).

How do I add Java?

At a first step, you can add a basic Java source file in the SensorDemo project and modify its souce code:

  • Install javac from Open JDK 1.8

  • In Studio, select 'Yes' in the General Settings | JVM section,

  • Save the project, and run the command Project | Run Java compiler

  • Configure your Tap.

Note that the Java source file will be available in the embedded editor. This editor is quite limited an we recommend using an external editor.

To go further, we suggest you follow the dedicated documentation.

Back to top