This Blog covers the latest Java technology for small devices and security in the IoT, mobile, ID and Payment

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 http://docs.oracle.com/javame/8.0/index.html
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 http://docs.oracle.com/javame/8.1/get-started-freescale-k64/toc.htm.
Then obviously you need a Java ME SDK 8.1 EA3 with new NetBeans plugins, which can be downloaded at OTN http://www.oracle.com/technetwork/java/embedded/javame/javame-sdk/downloads/index.html
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  https://blogs.oracle.com/javame/entry/measuring_temperature_with_raspberry_pi. If you have any question it is my pleasure to answer here or at Javas ME Embedded forum https://community.oracle.com/community/java/java_embedded/java_me_embedded


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

import java.io.IOException;
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 {
    @Overridepublic 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("com.oracle.product.version"); // Get product version
        System.out.println("platform = " + platform + " version = " + productVersion);
            GPIOPin orangeLED = (GPIOPin)DeviceManager.open(1); //Open Yellow LED see Getting Started Guide for details
            GPIOPin yellowLED = (GPIOPin)DeviceManager.open(2); //Open Green LED, see Getting Started Guide for detailsfor (int i = 0; i < 10; i++) {
            yellowLED.setValue(false);}} catch (Exception ex) {
            notifyDestroyed();}@Overrideprotected void destroyApp(boolean unconditional) throws MIDletStateChangeException {throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.}


Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha

Integrated Cloud Applications & Platform Services