Thursday May 12, 2016

Oracle Grows Java Capabilities for Internet of Things by releasing Java ME Embedded 8.3 and Java ME SDK 8.3

Companies of various industries have already benefited from Internet of Things (IoT) generated value.  As the number of IoT edge devices is growing dramatically and those appliances are becoming more and more intelligent, organizations are looking for horizontally scalable platforms which feed the needs of different verticals.  They are seeking a hardware agnostic standard based software stack which allows smooth movement across multiple architectures with the same codebase to rapidly enter new markets within a limited budget. The new Java ME Embedded 8.3 provides extensive support for market-leading embedded chip architectures and increases the range of supported OEM/partner platforms. With the new release, the Java ME Embedded 8 proofed security system has been enhanced to bring customers more capabilities and lower risks. Factory mass deployment and platform updatability are addressed by Java ME Embedded 8.3, giving customers confidence in the shortest time-to market and flawless evolution in future.

Oracle has announced today the latest releases to its Oracle Java Embedded product portfolio, Oracle Java ME Embedded 8.3 and Oracle Java ME Software Development Kit (SDK) 8.3, a complete client Java runtime and toolkit optimized for microcontrollers and other resource-constrained devices.

Release key features:

  • Oracle is extending its relationship with ST Microelectronics and adds improved support for the STM32F429I-EVAL evaluation platform within Java ME Embedded 8.3. A user now has the flexibility to configure peripherals and use custom hardware configurations without the need to rebuild or retest firmware.
  • Oracle and ST Microelectronics are also adding support for Java in the STM32F7 series of microcontrollers based on modern Cortex-M7 cores, which enables embedded developers to take advantage of popular Java programming features, and a developer preview for the 32F746GDISCOVERY development platform.
  • The new release reinforces the Java ME Embedded 8 Security system through the implementation of Secured File System supporting a number of HW Secured Elements to protect customer data from compromise. Java ME customers can encrypt application data (MIDlets, LIBlets), application meta-data and runtime configuration. Extended the application specific filesystem structure. 
  • SHA256 for application signature
  • Extending security API by adding HMAC support  
  • The platform updatability mechanism is now an essential part of Java runtime and allows in-field platform updates, leaving untouched all user applications in order to conserve demands on wireless connectivity.
  • As a follow-up to the Oracle and Intel joint announcement at JavaOne 2015, Java ME Embedded 8.3 has the capability to run on Intel Galileo gen 2 developers' board

Feel free to download and evaluate Java ME Embedded 8.3 and Java ME SDK 8.3.
Java ME Embedded 8.3

Java ME SDK 8.3

Give us your feedback at OTN community

Friday Feb 19, 2016

Meet Java ME Embedded team at Embedded World in Nuermberg

Just in case you have recently jumped into an embedded industry the Embedded World is one of the biggest trade fairs of this kind. The event is absolutely a must-attend for embedded architects, developers, product and purchasing managers or anybody else who is passionate about the internals of an electronic appliance. The Embedded World trade fair in Nuremberg enables you to experience the whole world of embedded systems, including modern directions as distributed intelligence and the Internet of Things.

 Oracle is extending its partnership with ST Microelectronics by developing Java ME Embedded ports to support two STM platforms based on ARM Cortex M4 and Cortex M7 MCUs. This should happen within the next release of our product, but you have a unique opportunity to see it in action next week. The Java ME Embedded team has a booth within the STM exhibition area at Embedded World Hall 4A / 4A-138 . We have prepared several impressive demo show cases for our booth. You will see how absolutely the same binary runs on both STM32429I-EVAL platform and Raspberry Pi. How particular software modules on ARM Cortex M4 platform update remotely with dependency resolution.  

We prepared an absolutely awesome security feature which utilizes a brand new STM HW security module helping to keep Java binary protected in embedded devices.

The brightest gem of our demo pod at Embedded World this year is a use case of Java ME Embedded platform integration with Oracle IoT Cloud Service. The demo is a prototype of a smart insurance system customizing an insurance plan based on driver behavior. The Java ME Embedded application gathers data from I2C accelerometer, processes it and as soon as the acceleration exceeds a predefined threshold, an alert message is generated and securely sent to Oracle IoT Cloud Service. The stream of messages is then processed in real time by an analytic engine, and based on the results of that analysis, an integrated external business application is notified about unusual driving actions for example rush driving.

I am really happy to be at Embedded World with two exceptional Oracle engineers. Alexey Bakhtin, who is the security lead in our product, and Alexander Mironenko, the porting lead. They will be able to answer any platform related or deeply technical questions. Come to our booth and meet them in person.

Also, if you want to catch up with me in person in Nuremberg, feel free to reach out via this blog or my twitter @gigabel.

Thursday Feb 11, 2016

Lightweight web server for Java ME Embedded 8

To help programmers quickly start with Java ME Embedded 8 development, we have released a new bundle with demo applications. It is now available for download on OTN:

The package includes two applications: a Web Services with JAX-RS client sample and a Lightweight Web Server for Java ME Embedded. This software is dual-licensed to you under the MIT License (MIT) and the Universal Permissive License (UPL). So it is easy to re-use the demo source code within your projects. For a full license text please read the license.txt file of the archive.  

The IoT concept implies that field devices use a polling approach to connect to IoT cloud service. However, there are still a number of cases when direct access to the edge device is required, such as an initial appliance setup. The most convenient and user friendly way to configure system parameters remotely is via web access.  
The Java ME Embedded development team have implemented a lightweight web server which is capable of handling HTTP requests and sending back HTTP responses. One of the key benefits of Java ME Embedded is the ability to run the same binary on different hardware, so that you can run this web server on any Java ME Embedded 8.2 device including Emulator.  

The feature set of the server is really limited by basic functionality. The Web Server supports HTTP protocol of 1.1 and 1.0 with some limitations, explained in the webserver_readme.txt document. However, those limitations can be eliminated by extending the demo server, the demo distribution license is MIT so you can change the source code, or partly reuse it, within your projects.

If you have any questions or suggestions, feel free to reach us at the Java ME Embedded forum:

Wednesday Sep 16, 2015

Oracle Java ME Embedded 8.2 and Oracle Java ME SDK 8.2 have just been unveiled.

A new release of Oracle Java ME Embedded 8 is now available for download on OTN:

This product is an evolving release of Java ME Embedded 8 platform specifically built to address the embedded developers’ requirements and shorten go-to-market time for the products on the edge of Internet of Things solutions. Java ME Embedded 8.2 expands security functionality and robustness of the runtime, enables new and improved connectivity features, enhances deployment options and brings several highly effective optimizations to the Virtual Machine and core libraries. Oracle Java ME SDK 8.2 is also delivering the embedded development experience to Linux users.

  • Application deployment and update capabilities of Java ME Runtime have been improved in the release. Device manufacturers and solution providers are able now to pre-provision software components with Java ME Embedded Runtime. Required applications will be installed and configured in unattended mode on the first Virtual Machine start. Updating runtime is getting really simple in a new version of the product. Standard approach in classical solutions to renew embedded OS is just complete re-flashing of a runtime and all applications on a device, which in some cases might be unacceptable due to expensive or slow connections. Java ME Embedded 8.2 allows you to keep all installed software unchanged after runtime update.
  • Security and communication functionality have been extended by supporting DTLS client feature and providing an API to use Pre-Shared Keys. Crypto hardware acceleration is now supported on platforms which are capable of this functionality.
  • The Device Access API (a dedicated Oracle API to enable access to device peripherals) has evolved to version 1.1, which includes several improvements to make access to peripheral hardware even easier and more reliable.
  • The Java ME Embedded VM team has been working hard on a set of runtime optimizations which have been honed and applied in the Java ME Embedded 8.2 release. The results are really impressive. With previous release on Freescale K64-FRDM board with 256KB of RAM developers had approx. 60KB of free heap for their Java applications. In Java ME Embedded 8.2 the free application memory has been increased to around 150KB, which is more than double compared to before and allows developers to create even more advanced Java applications for micro-controller platforms.
  • And, last but not least, Linux desktop users are welcome now to develop Java ME Embedded applications with Java ME SDK 8.2. Netbeans and Eclipse IDEs are supported as well as Device Manager with a new functionality. To simplify on-device development Device Manager offers an updated device flashing tool to make Raspberry Pi or Freescale K64-FRDM Java-enabled devices with only a few mouse clicks.

Download Oracle Java ME Embedded 8.2 and Java ME SDK 8.2 to experience Java development on resource-constrained embedded devices.

Java ME Embedded 8.2:

Java ME SDK 8.2:

Java ME Embedded 8.2 and Java ME SDK 8.2 Documentation:

Please give us your feedback on the new release on Java ME Embedded forum:

Tuesday Sep 08, 2015

Smart Solar Panel Control system source package available at Java ME SDK update centre

If you have Java ME SDK 8.1 installed already, you can check that a new update can be installed from Java ME SDK Update Centre. The update package includes documentation, binaries, and sources to build Smart Solar Panel Control system. By releasing this update we intended to demonstrate how reasonably complicated application can be built using Java ME Embedded 8.1 platform. 

The demo guide allows to create a hardware platform which is capable to find the position for the solar panel with the maximum luminosity and report the data to an enterprise application. 

Within this project the same binary is running on 3 completely different HW platforms: Raspberry Pi, STM32429I-EVAL and Freescale Kinetis K70 (binary is not available on OTN for public use)

After the update installation a demo/ folder will be created in the Java ME SDK 8.1 directory. Inside it you will find folders with binaries, documentation and  projects for Netbeans and Eclipse.


 source code, NetBeans and Eclipse projects 

of ME Embedded application


 source code of  the  demo part shared between ME Embedded 

 and Java FX applications 

 binaries/   folder with executable, library and configuration files
 docs/           folder with documentation

If you have any issue or question related to Java ME Embedded feel free to ask at our forum:

Friday May 15, 2015

Using Line User Interface with Oracle Java ME Embedded 8.1 on STMicroelectronics Evaluation board

Oracle Java ME Embedded 8.1 Developers Preview for ST Micro Evaluation board has been recently released. 

As I mentioned in my previous post, one of the release additions is a Line User Interface (LUI) API hardware implementation. LUI is an optional API of MEEP (JSR 361), which enables rendering text information on a display. In Java ME Embedded 8.0 this functionality was supported only by Java ME SDK Emulator and now it is possible to use a hardware display to implement a simple user interaction in Java ME Embedded applications. 

Java ME SDK 8.1 update includes a very good LUI sample. The sample is an on-screen text menu navigated by a built-in joystick. The menu has 12 items, several nested items, and a status line reflecting a current user choice.  Code of the sample is accompanied very detailed comments, which can definitely helps start developing interactive applications very fast.

Below is a basic example that demonstrates the use of the built-in screen on STM32429I-EVAL board with Java ME Embedded and LUI API.

 Happy Java coding for embedded.

import java.util.Iterator;
import javax.microedition.lui.Display;
import javax.microedition.lui.DisplayColor;
import javax.microedition.lui.DisplayListener;
import javax.microedition.midlet.MIDlet;

public class LUIDemo extends MIDlet implements DisplayListener {

    public void startApp() {
        // Get Display instance and configure it
        Iterator<Display> displays = Display.getDisplays(false);
        Display myDisplay =;
        // Assign a state change listner to Display instance
        myDisplay.addDisplayListener((DisplayListener) this);
        //as soon as the hardware display will be assigned to myDisplay instance
        //hardwareStateChanged method will be invoked with newState = true 
        synchronized (myDisplay) {
            try {
                // Assign hadware display to myDisplay 
                // Assigning display may take some time,
                // so that we need to wait the operation acomplishement 
                // Now myDisplay has HW display assigned and we can use it
            } catch (InterruptedException ex) {
        //Display.setText is overloaded method. 
        //In the example below the text "Hello world" is blinking.
        myDisplay.setText(0, "Hello world", true, false);
        myDisplay.setText(1, "I love programming Java ME Embedded on STM32429EVAL");

    public void destroyApp(boolean unconditional) {

    // hardwareStateChanged method is invoked as the hardware display is assigned or unassigned
    public void hardwareStateChanged(Display d, boolean newState) {
        //Setting up assigned hardware display
        d.setLightingColor(new DisplayColor(0xFF, 0, 0));
        d.setCurrentTextColor(new DisplayColor(0, 0, 0xFF));
        d.setBackgroundColor(new DisplayColor(0, 0, 0));
        // notify all threads are waiting for Display Object
        synchronized (d) {

    public void displayAdded(Display d) {

    public void displayRemoved(Display d) {

Friday May 08, 2015

Oracle Java ME Embedded 8.1 released with support of STMicroelectronics STM32F4 micro controller

Oracle Java ME Embedded 8.1 Developer Preview for STM32429I-EVAL has been released today. With this release, the STM32F4 series of micro controllers is joining the family of platforms supported by Java ME Embedded. 
ST Micro produces widely used and very popular high-performance MCUs with the STM32F4 core, which is based on the ARM Cortex-M4 architecture. The detailed information can be founded at STM web.  The Java ME 8.1 Embedded STM port release enables developers to run feature-rich Java ME Embedded applications on the STMicroelectronics STM32429I-EVAL developer evaluation board. 

The Java ME 8.1 follow-up release for STM has full CLDC 8 support, networking, storage, and peripheral I/O support, including GPIO, I2C, SPI, ADC, UART, and other interfaces. The interesting particularity of the release is the implementation of this port on top of ARM Cortex Microcontroller Software Interface Standard (CMSIS), which will allow Oracle and its partners to make feature porting easier and faster.

With this release, developers are able to access on-board screen with the simple Line User Interface (LUI) API. Java ME SDK Update center is distributing an update package with a great example of developing a text menu operated by on-board joystick. After its installation, a LUI sample can be found at your local drive:

Do not forget to update Java ME 8.1 SDK by navigating to NetBeans or Eclipse menu Tools -> Java ME -> Java ME SDK Update Center and installing the STM32429I-EVAL SDK Update. After applying this update, you will be able to work with STM32429I-EVAL as with any other ME SDK supported board.

Feel free to ask any questions and provide your feedback at our forum:

Wednesday Feb 04, 2015

January-February Java Magazine issued

Recently the first issue of Java Magazine 2015 have been released. If you are still not a subscriber, blame on you. It is absolutely free and as publisher admitted: "Java Magazine is an essential source of knowledge about Java technology, the Java programming language, and Java-based applications for people who rely on them in their professional careers, or who aspire to.” Subscribe here:

This issue contain an article "Embedded: Get Started with Oracle Java ME Embedded 8 on Microcontrollers”, which is giving to readers a detailed explanation on how to develop Java ME applications for micro controllers and connect to peripheral by DIO API. Significant part of the article is describing how to connect to I2C sensor using it’s datasheet.

Happy reading, and just in case you have any question I welcome you to our forum

Wednesday Nov 19, 2014

Java ME Embedded 8.1 brings Java to ARM Cortex M4 and provides Eclipse users with tools for embedded development

A couple days ago, Java ME Embedded 8.1 was released. The new version of the Java ME Embedded platform has two significant enhancements. First, it works on ARM Cortex M4 with very limited RAM size by delivering a port for Freescale K64F. Second, it provides Eclipse IDE support in Java ME SDK. The link to the release page:

FRDM-K64F is based on  MK64FN1M0VLL12 MCU (120 MHz, 1 MB flash memory, 256 KB RAM, low-power, crystal-less USB, and 100 Low profile Quad Flat Package (LQFP)). It is has a form-factor of Arduino™ R3 pin layout. The FRDM-K64F goes with a lot of peripherals to enable rapid prototyping. In addition to UART, I2C, SPI, and GPIO interfaces on board, it has 3 LEDs and 2 switches which are accessible from Java Runtime. Another helpful device that is integrated into K64F is accelerometer-magnetometer with I2C interface (FXOS8700Q). You can easily access it from your Java application and create a compass application, for instance. Find the code example below the post..

Java ME SDK 8.1 brings smooth experience of Java Embedded developers to the Eclipse world. Java ME SDK plugin for Eclipse is based on the recently released Mobile Tools for Java TM (MTJ) 2.0 which had been done with significant efforts of Oracle's engineers. Now, all impressive features of Java ME SDK, such as on-device debugging, memory and network monitors, CPU profiling, and memory profiling are available in Eclipse. To install it, you need just to go the OTN web, download and install Java ME SDK with Eclipse plugin

If you have any questions or suggestions, please speak up at our forum:
The best source of information about Java ME Embedded is Java ME Documentation portal:

How to get a device ID from FXOS78700Q on K64F:
public class FXOS8700Q extends MIDlet {

    private I2CDevice fxos8700q;

    final int FXOS8700Q_STATUS = 0x00;
    final int FXOS8700Q_OUT_X_MSB = 0x01;
    final int FXOS8700Q_OUT_Y_MSB = 0x03;
    final int FXOS8700Q_OUT_Z_MSB = 0x05;
    final int FXOS8700Q_M_OUT_X_MSB = 0x33;
    final int FXOS8700Q_M_OUT_Y_MSB = 0x35;
    final int FXOS8700Q_M_OUT_Z_MSB = 0x37;
    final int FXOS8700Q_WHOAMI = 0x0D;
    final int FXOS8700Q_XYZ_DATA_CFG = 0x0E;
    final int FXOS8700Q_CTRL_REG1 = 0x2A;
    final int FXOS8700Q_M_CTRL_REG1 = 0x5B;
    final int FXOS8700Q_M_CTRL_REG2 = 0x5C;
    final int FXOS8700Q_WHOAMI_VAL = 0xC7;
    final int UINT14_MAX = 16383;

    public void startApp() {
        ByteBuffer buffer = ByteBuffer.allocateDirect(1);
        try {
            fxos8700q =, I2CDevice.class);
            buffer = read(FXOS8700Q_WHOAMI, 1, 1);
        } catch (IOException ex) {
        String id = String.format("%8s", Integer.toBinaryString(buffer.get(0) & 0xFF)).replace(' ', '0');

    public void destroyApp(boolean unconditional) {

    void write(int address, int addressSize, ByteBuffer data) throws IOException {
        fxos8700q.write(address, addressSize, data);

    ByteBuffer read(int address, int addressSize, int bytesToRead) throws IOException {
        ByteBuffer buffer = ByteBuffer.allocateDirect(bytesToRead);
        fxos8700q.begin();, addressSize, buffer);
        return buffer;

Monday Nov 17, 2014

Mobile Tools for Java™ (MTJ) 2.0 plugin for Eclipse IDE released

I proud to announce that a new version of MTJ plugin for Eclipse have recently been released with a significant contribution of Oracle's engineers. Mobile Tools for Java TM (MTJ) 2.0 release is making MTJ plugin IoT ready by supporting Java ME Embedded 8 platform. Oracle Java ME Embedded 8 is Java TM Runtime client optimized for ARM based micro controllers and other constrained devices. Now MTJ 2.0 provides a support for CLDC 1.8 configuration (JSR 360), MEEP 8.0 profile (JSR 361) support, MEEP 8.0 profile (JSR 361), better IMP-NG profile (JSR 228) support. MEEP 8.0 permissions mechanism was significantly changed and looks similar to Java SE, MTJ 2.0 supports MEEP security model. Code Validation Builder provides an ability to perform pre-compilation analysis and generates warnings using 3rd party plugins created on top of MTJ. Also support for Java ME APIs javadocs in zip archives provided by the new version of MTJ. 

 Detailed information and download links can be found at the project page 

Friday Oct 24, 2014

Java ME Embedded is able to run with 256Kb of RAM only

Around a JavaOne conference timeframe we announced Java ME Embedded 8.1 Developer Preview release.  This release is bringing Java ME Embedded to a microcontrollers with ARM Cortex M architecture with mbed RTOS. Java ME Embedded is now capable to run on Freescale K64F board. The FRDM-K64F is an ultra-low-cost development platform for Kinetis K64.  The K64F board has a form-factor which compatible with the Arduino™ R3 pin layout, providing a wide range of expansion board options.

FRDM-K64F based on  MK64FN1M0VLL12 MCU (120 MHz, 1 MB flash memory, 256 KB RAM, low-power, crystal-less USB, and 100 Low profile Quad Flat Package (LQFP)) The FRDM-K64F is feature packed with a lot of peripherals to enable rapid prototyping. 

As always the best way to start with Java ME on any new platform is our Getting Started Guide, which can be found at Java ME Documentation page

What I would like to emphasize is a new Flasher capabilities of Java ME SDK. If you have a new K64 you can make it Java-enabled by just clicking "Flash" button in Device Connection Manager. I will explain you how to do it.

Firstly, if you have not installed mbed Serial Driver and USB Serial it is better do it using detailed instruction from K64 GSG

Then obviously you need a Java ME SDK 8.1 EA3 with new NetBeans plugins, which can be downloaded at OTN

Now you can check new flashing capabilities.
1. Go to t the Windows tray and click on Device Connection Manager 8.1
2. Click "Flash" button and pick your connected K64 board from the list following.
3. Say: "Wow, how cool it is to enable mbed device with Java capabilities!"

As I said before, K64 is a very convenient platform for prototyping. It has multicolor LED, switches and other peripherals on board. Let's make LEDs blinking.

Do not forget to set API permissions as described in one of my previous post If you have any question it is my pleasure to answer here or at Javas ME Embedded forum

Create a new MidLet and copy code below instead of generated. Do not forget to rename the class

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import jdk.dio.DeviceManager;
import jdk.dio.gpio.GPIOPin;
import jdk.dio.gpio.GPIOPinConfig;

 * @author abelokry
public class JavaMEOnK64 extends MIDlet {
    public void startApp() {
        try {
            String platform = System.getProperty("microedition.platform");  // Get Platform name it might be useful to identify the platform your midlet running and configure accordingly
        String productVersion = System.getProperty(""); // Get product version
        System.out.println("platform = " + platform + " version = " + productVersion);
            GPIOPin orangeLED = (GPIOPin); //Open Yellow LED see Getting Started Guide for details
            GPIOPin yellowLED = (GPIOPin); //Open Green LED, see Getting Started Guide for details
            for (int i = 0; i < 10; i++) {
        } catch (Exception ex) {

    protected void destroyApp(boolean unconditional) throws MIDletStateChangeException {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.

Wednesday Oct 01, 2014

Java ME Embedded Documentation survey

Java ME documentation team has put together a short survey (7 questions) which help us understand the best way to improve documentation for Java ME Embedded. Please invest 5 minutes of your time to return your investment in near future

Thursday Jul 31, 2014

LIBlets Signing Patch released

LIBlets Signing Patch available for download through Java ME SDK Update Center. This patch fixes JadTool that used incorrect JAD attribute for LIBlets signature. To apply this patch in NetBeans please follow the steps below.

1. Run Java ME SDK Update Center

2. Under "Available" tab you will see the new item (Internet connection required)

3. Click the check box and install the patch

4. Check if it is appeared under "Installed" tab 

Happy embedded coding with Java ME SDK! 

Friday Jul 04, 2014

Measuring temperature with Raspberry Pi, I2C sensor and Java ME 8

Nowadays, developers reveal their growing interest to the microcontrollers, devices based on ARM processors, and other non-traditional hardware. To satisfy the increasing demand, the market introduced  Arduino, Beagle Board, Raspberry Pi, and many other devices.
Oracle provides two Java platforms for ARM-based devices. Whereas Java SE Embedded is aimed for powerful hardware,  Java ME Embedded works better for resource-constrained devices.

Oracle Java ME Embedded is a Java Runtime optimized for constrained ARM based devices. Minimally acceptable requirements for Java ME embedded are 128Kb of RAM and 1Mb of ROM. Using Java ME Embedded in your projects can bring several benefits. First of all,  "write once, run everywhere" principle, now with some restrictions can be applied to embedded world. Second, AMS (Application Management System), integrated into the platform. enables deploying, updating, starting, stopping, and destroying applications. Third, you have an API to access peripheral, such as SPI, I2C, URAT, and GPIO pins (DAAPI - Device Access API). Forth,, you will get a free and powerful developer tools as well as a set of standard services: File I/O (JSR 75), Wireless Messaging (JSR 120), Web Services (JSR 172), Security and Trust Services Subset (SATSA – JSR 177), Location (JSR 179), and XML (JSR 280).

As you can see, Oracle Java ME Embedded is a cross-platform product, which supports a set of ARM based devices. The current version is Oracle Java ME 8. The platform is ported to ARM11/Linux (Raspberry Pi Model B), ARM9/BREW MP (Qualcomm IoE development), and X86/Windows (emulator). These are reference implementations developed by Oracle engineers. If there is customer’s need, the platform can be ported to other devices.

Smart home

Personally, I would really like to see my home automated. It is always a true pleasure to communicate with smart people and a real delight to live in a smart home. The first idea that usually strikes my mind when I’ve got a small piece of hardware is to automate something at my house. A typical task is a temperature monitoring.
To monitor temperature you can use UART, SPI, or I2C sensors. Usually, I2C ones are a bit cheaper, so that I will use Dallas Semiconductor DS1621 in DIP8 form factor to make a digital thermometer with Raspberry Pi and Java ME Embedded.

Raspberry Pi hardware setup

First of all, we need to physically connect the sensor and a RPi
pin1 - SDL
pin2 - SCL
pin4 - GND
pin8 - Vdd

If you read a datasheet of DS1621, you know that the sensor address at the I2C bus can be configured by pins 5-6-7. For our sensor, let's turn them all to 1 by closing contacts to the power.

Setup software at Raspberry Pi

Install Raspbian and update it.
To enable I2C interface on Raspberry Pi it is necessary to upload the relevant module
add 2 lines to /etc/modules


Reboot RPi
Install Linux tools to operate with I2C
sudo apt-get install i2c-tools

Detect an address of our sensor

sudo  i2cdetect -y 1

address is 4f (remember it)

Download Oracle Java ME Embedded 8  for Raspberry Pi Model B.
Accept a license agreements
Copy Runtime to Raspberry Pi to your favorite location and unpack it
for instance ~/JavaME/

Start Runtime with AMS (Application Management System) under the root privileges
sudo ~/JavaME/bin/
We have just  finished with the RPi setup

Developer tools setup

If you have not yet played with Oracle Java ME SDK 8, set it up for Netbeans.

Add our RPi as a deploying device
In NetBeans choose: Tools -> Java ME -> Device selector
The most probably your Raspberry already autodetected by Java ME SDK and exists in the list of connected devices. If it is not, you can find the Device Connection Manager in your Windows tray and add RPi manually.  To do it, just click add and write the IP address of your RPi and define a debug level you need.

Create a new project in Netbeans:  New Project -> Java ME -> Embedded application

IDE creates a skeleton of Java ME application, which extends a MIDlet class  and consists of 3 methods: startApp(), pauseApp(), anddestroyApp(boolean unconditional)

Java ME Embedded provides us with an API to communicate with peripherals – DIO API (Device Input/Output API). To operate with I2C, we need to create a configuration of the device, pass it to the factory, and if everything is alright, we will get an instance of the I2CDevice class required to communicate with the sensor.

To allow your application to use a specific API on the device you need to set up API Permissions.

In Netbeans click right button on your project in Project Properties go to tab Application Descriptor and to access I2C device add 2 lines:

Permission Protected Resource Name
Action Requested







To run a code below on your RPi, right-click  on your device in Device Selector window, and under "Run project" menu click on the project you would like to run on Raspberry. Alternatively,  you can use the project properties in Platform tab to define a Device. In that’s the case, NetBeans always uses RPi as a target device for deployment.

Now you should know the temperature in room.

The best collection of docs about Java ME Embedded 8 can be found here:
Have fun!

 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.

import javax.microedition.midlet.MIDlet;

import java.nio.ByteBuffer;
import jdk.dio.DeviceManager;
import jdk.dio.i2cbus.I2CDevice;
import jdk.dio.i2cbus.I2CDeviceConfig;

public class JavaMEThermometer extends MIDlet {

    private final int CFG_ADDRESS = 0x4f;  //Sensor address
    private final int FREQ = 100000;  //Bus frequency from Datasheet
    private final int ADDRESS_SIZE = 7; //Address size from Datasheet
    private final int BUS_ID = 1; // Internal bus ID in Java ME Embedded from Getting Started Guide

    // Registers addresses and definitions of configuration parameters of DS1621 from Datasheet
    private final int REG_READ_TEMP = 0xAA;
    private final int RT_ADDR_SIZE = 0x01;
    private final int READ_TEMP_SIZE = 0x02;
    private final int READ_TEMP_VAL = 0x00;
    private final int REG_ACC_CONF = 0xAC;
    private final int ACC_CONF_VAL = 0x00;
    private final int REG_START_CONV = 0xEE;
    private final int REG_STOP_CONV = 0x22;

    public void startApp() {
        // Create a configuration
        I2CDeviceConfig config = new I2CDeviceConfig(BUS_ID, CFG_ADDRESS, ADDRESS_SIZE, FREQ);
        I2CDevice device = null;
        try  {

            // Open device using configuration
            device = (I2CDevice);

            // Config sensor to continuous temperature measuring according to Datasheet
            write(device, new byte[]{(byte) REG_ACC_CONF, (byte) ACC_CONF_VAL});
            write(device, new byte[]{(byte) REG_START_CONV});

            // Read temperature
            ByteBuffer tempBuf = ByteBuffer.allocateDirect(READ_TEMP_SIZE);
  , RT_ADDR_SIZE,tempBuf);
             // Profit!  
            System.out.println("Temperature is:" + tempBuf.get(0));

        } catch (Exception ex) { // Bad practice. Only for consiceness
        } finally {
            // Close device
            if (device != null) {
                try {
                } catch (IOException ex) {
                // Destroy application


    public void pauseApp() {

    public void destroyApp(boolean unconditional) {

    private void write(I2CDevice i2c, byte[] buffer) {
        try {
        } catch (IOException ex) {
            System.out.println("[I2CThermometerTest] configure exception: " + ex.getMessage());
        } catch (Exception ex) {
            System.out.println("[I2CThermometerTest] Peripherial not available exception: " + ex.getMessage());

Tuesday Jun 17, 2014

Oracle Java ME Embedded 8.1 Early Access for Raspberry Pi

Less then two months ago the innovative Java ME 8 have been released. Now you are able to play with  Oracle Java ME Embedded 8.1 Early Access for Raspberry Pi. Download link:

You are also welcome to Java ME Embedded forum to discuss your thoughts on the new release


Topics including Java ME embedded, Java ME SDK, Internet of Things, Edge devices, Java on MCU and more


« May 2016