java_coffee

Running a Java ME8 MIDlet on a STM32f4Discovery board…. I tried it…

Hello everyone,

after I read an older Java Magazin Article about Oracle targeting the IoT world with it’s JavaME 8 platform I tried to install and run it on the STM32f4 discovery board. After downloading about 1GB of tools and installing it on a Windows7  machine, I finally flashed the discovery board with the VM.

photo 2

Installed some USB drivers and tried to connect to upload a MIDlet flashing an LED similar to the Arduino Blink demo. For an old JavaME programmer (ColorKVM, kAWT, ME4SE) as I started to work on mobile phones more than a decade ago, the sample looks very familiar to me:

package me8embeddedapplication1; 

import com.oracle.deviceaccess.PeripheralManager; 
import com.oracle.deviceaccess.gpio.GPIOPin; 
import java.io.IOException; 
import java.util.logging.Level; 
import java.util.logging.Logger; 
import javax.microedition.midlet.MIDlet; 

/** 
 * @author michaelkroll 
 */ 

public class Midlet extends MIDlet { 

  @Override 
  public void startApp() { 
    try { 
      GPIOPin pin = (GPIOPin) PeripheralManager.open(1); 
      for (int i = 0; i < 10; i++) { 
        pin.setValue(true); 
        Thread.sleep(1000); 
        pin.setValue(false); 
        Thread.sleep(1000); 
      } 
      pin.close(); 
    } 
    catch (IOException ioe) { 
      Logger.getLogger(Midlet.class.getName())
        .log(Level.SEVERE, null, ioe); 
    } 
    catch (InterruptedException ex) { 
      Logger.getLogger(Midlet.class.getName())
        .log(Level.SEVERE, null, ex); 
    } 
  } 

  @Override public void pauseApp() { 
  } 

  @Override public void destroyApp(boolean unconditional) { 
  } 
}

Well, I compiled and tried to run this simple MIDlet as described in the documentation Netbeans tries to connect to the board, but stops the build after a while returning an error that it cannot connect. When I start the CLI, and ask the ams for a list of install MIDlets, I’m getting an error, that the device is not connected.

Screen Shot 2014-02-07 at 00.43.37

 

Well it is early access, but I was expecting that I even could install a small MIDlet to get an LED blink.

Has anyone yet some experience which is more successful than mine?

The Early Access version of the software for the STM32f4 Discovery board was released in September 2013, which is rather old now. Hope that Oracle will release another version of the JavaME8 for the STM32f4 Discovery board soon.

Hope to write about better results the next time,

Michael.

8 Responses to Running a Java ME8 MIDlet on a STM32f4Discovery board…. I tried it…

  1. Bob Robert February 8, 2014 at 04:15 #

    I ran into the same problem as you. I’ve noticed that most of the topics tying Java ME and the stm32f4discovery together are disappearing from the oracle website.

    • Michael Kroll February 8, 2014 at 12:07 #

      Hi,
      my post on the forum has been approved though.
      I’ll try to visit Embedded World 2014 and hopefully talk to an Oracle representative about this.
      Let’s see how it comes out. Of course I’ll keep you posted.

      Michael.

    • Michael Kroll February 9, 2014 at 11:33 #

      Hi Rob,
      I was just visiting this website again: http://www.oracle.com/technetwork/java/embedded/downloads/javame/index.html
      The release notes for the Raspberry version are now mentioning “Beta Draft: 2014-02-05” called EA 2 and as you mentioned the version release notes for the STM32f4 Discovery are pointing into a 404 error 🙁

      Hope that they have just missed to update the webpages. I will write a question on their forum now, hoping to get an answer from them.

      Cheers,
      Michael.

  2. Bob Robert February 12, 2014 at 03:34 #

    Keep me posted. I would like to know what happened also. I specifically purchased the STM32F4Discovery so I can develop java code with it.

    • Michael Kroll February 12, 2014 at 18:56 #

      Hi Robert,
      well I ordered on for this too. But it seems that I finally cannot make it to Embedded World this year, so we need to wait what Oracle will come up with.

      Cheers,
      Michael.

    • Michael Kroll February 14, 2014 at 21:29 #

      Hi Robert,
      it seems that Oracle added support for another embedded platform now, but there are no new resources for the STM32f4 Discovery board.
      Read my conversation with Terrence Barr here: https://community.oracle.com/thread/2609946

      Cheers,
      Michael.

  3. Rolf Hemmerling March 16, 2015 at 22:42 #

    Hello,
    would somebody be so kind and offer me the discontinued offical JVM downloads for the STM32f4 Discovery board ?

    I asked Terrence already, in vain :-(.

    If you want to tell me privately, on this page is my email address :-):
    http://www.hemmerling.com/doku.php/en/imprint.html

    Sincerely
    Rolf

    • Michael Kroll March 20, 2015 at 16:40 #

      Hi Rolf
      sorry but I have no backup of the files and deleted them already.

      Michael

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Powered by WordPress. Designed by WooThemes