The Java ME Embedded runtime delivery might include preinstalled IMlets. When started, the Java ME runtime checks availability of preinstalled IMlets and automatically installs them on the STM32429I-EVAL board, if they were not installed during previous runs.
Preinstalled IMlet files are located in the /java/appdb
directory on the board and have the following format:
/java/appdb/Preinstalled_app_<num>.jar
/java/appdb/Preinstalled_app_<num>.jad
In this notation, <num>
stands for a preinstalled IMlet sequence number. Can be any number starting from 1.
There are two different ways to connect to the STM32429I-EVAL board.
Run NetBeans IDE 8.1, which will use the Oracle Java ME SDK. If you wish to use the NetBeans IDE, skip to the About Using NetBeans with the STM32429I-EVAL Board below.
Manually start a Developer Agent program on the desktop host and run commands using the Application Management System (AMS) CLI.
The Developer Agent program is a JAR file inside the util
directory of the Oracle Java ME Embedded distribution, and is named proxy.jar.
You can start the Developer Agent program on the desktop host computer either in a server or a client mode. After the Developer Agent program starts, you can use the AMS CLI to communicate with the board.
The server mode is used by default. In this mode, start the Java runtime on the STM32429I-EVAL board. Then do the following.
You can use the Command-Line Interface (CLI) to install, run, stop, and remove your applications.
The following procedure explains how to install and run an IMlet by using the CLI.
Note:
The CLI feature in this Oracle Java ME Embedded software release is provided only as a concept for your reference. It uses connections that are not secure, without encryption, authentication, or authorization.
You can use the command-line interface to run the AMS commands shown in Table 2-1. For a complete list of CLI commands, see the Using the Command-Line Interface in Oracle Java ME Embedded Developer's Guide.
Table 2-1 AMS CLI Commands
Syntax | Description |
---|---|
|
Show information about the installed IMlet. To determine the index of a specific IMlet, use the |
|
Install an IMlet using the specified JAR or JAD file, specified as a URL. An optional user name and password can be supplied for login information either in the URL or by using the |
|
List all installed IMlet suites and their status or show the detail of a single suite. |
|
Remove an installed IMlet. |
|
Run the specified IMlet or the default if none is specified. You can specify optional debug parameter to run the IMlet in debug mode. |
|
Stop the specified IMlet or the default if none is specified. |
|
Update the installed IMlet. An optional user name and password can be supplied for login information by using the |
You can use the commands summarized in Table 2-2 to modify system properties.
Table 2-2 Security and Properties Commands
Syntax | Description |
---|---|
|
List the available commands or detailed usages for a single command. |
|
Show the list of names of properties which control the Java ME runtime (properties that are set in the |
|
Return a value of the property identified by |
|
Set a property identified by |
|
Save properties to an internal storage. |
|
Blacklist clients and applications. |
File system commands are summarized in Table 2-3. Note that the system can only access files inside of the /java/appdb
directory, and cannot use relative paths that shift the current location outside of this directory (for example, using "..
" in the path).
Table 2-3 File System Commands
Syntax | Description |
---|---|
|
Change the working directory on the device. |
|
Delete a file on the device. |
|
Copy a file from the device to the host. |
|
Display a list of files and subdirectories in a device directory. In a result listing, subdirectories are marked with a forward slash. |
|
Create a directory on the device. |
|
Write the current working directory on the device. |
|
Copy a local host file to the device. |
|
Deletes an empty directory on the device. |
Network commands are shown in Table 2-4.
Table 2-4 Networking Commands
Syntax | Description |
---|---|
|
Show the networking information of the system. |
|
Reconnects the network and reboots Java. |
The CLI supports working with multiple devices. You can use the device commands summarized in Table 2-5.
Table 2-5 Device Commands
Syntax | Description |
---|---|
|
List all connected devices. |
|
Make the specified device current. |
|
Perform either a shutdown of the board or a reboot if the |
|
Terminate the current CLI session. |
You can use the keystore commands summarized in Table 2-6.
Table 2-6 Keystore Commands
Syntax | Description |
---|---|
|
Delete a key from a ME store. |
|
Import a public key from a JCE keystore into a ME keystore. |
|
List the owner and validity period of each key in a ME keystore. |
Running and debugging IMlet projects on the ST Micro STM32429I-EVAL board using the NetBeans IDE 8.1 requires the following software:
NetBeans IDE 8.1
Oracle Java ME SDK 8.3
Oracle Java ME SDK 8.3 plugins for NetBeans
To install the Java ME SDK 8.3 toolkit in NetBeans 8.1, follow these instructions:
.nbm
extension, press the Open button to choose them, then press the Install button to install each of the plugins. You can safely ignore any warnings about the updates not being digitally signed. After the plugins are installed, restart the IDE.Follow these steps to add the STM32429I-EVAL board to the Device Connections Manager in Oracle Java ME SDK 8.3:
There are two ways to assign the STM32429I-EVAL board to your project:
Using an existing NetBeans Project with an IMlet you want to run or debug.
Creating a new NetBeans project.
After you assign the board to your project, clicking Run Project in the NetBeans IDE runs your IMlets on the board instead of on the emulator.
If you already have an existing NetBeans project with an IMlet that you want to run or debug on the board, follow these steps:
If you are creating a new NetBeans project, follow these steps:
When the new project is created, it is displayed in NetBeans IDE with the name GPIOExample1
.
Now you can update the generic project that you created with the sample code shown in the following example. This sample application obtains an object for GPIO pins 1 through 4 (representing four LEDs on the board) from the DeviceManager
object, and repeatedly toggles their high/low values.
package gpioexample1; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.microedition.midlet.MIDlet; import jdk.dio.DeviceManager; import jdk.dio.gpio.GPIOPin; public class GPIOExample1 extends MIDlet { GPIOPin pin1; GPIOPin pin2; GPIOPin pin3; GPIOPin pin4; @Override public void startApp() { try { pin1 = (GPIOPin) DeviceManager.open(1); pin2 = (GPIOPin) DeviceManager.open(2); pin3 = (GPIOPin) DeviceManager.open(3); pin4 = (GPIOPin) DeviceManager.open(4); for (int i = 0; i < 20; i++) { System.out.println("Setting pins to true..."); pin1.setValue(true); pin2.setValue(true); pin3.setValue(true); pin4.setValue(true); Thread.sleep(2000); System.out.println("Setting pins to false..."); pin1.setValue(false); pin2.setValue(false); pin3.setValue(false); pin4.setValue(false); Thread.sleep(2000); } } catch (IOException | InterruptedException ex) { Logger.getLogger(GPIOExample1.class.getName()).log(Level.SEVERE, null, ex); } } @Override public void pauseApp() { } @Override public void destroyApp(boolean unconditional) { } }
In the NetBeans Projects window, you see the sample project with the file GPIOExample1.java
. Follow these steps:
Double-click the GPIOExample1.java
file in the Projects window.
Copy the sample code and paste it in the Source window.
Clean and build the GPIOExample1
project by clicking on the hammer-and-broom icon in the NetBeans toolbar or by selecting Run then Clean and Build Project (GPIOExample1).
Before running the example, we must add the appropriate permissions for the Device I/O APIs to access the peripherals.
Applications such as the previous example that require access to Device I/O APIs must request the appropriate permissions. For more information about the various permissions required to access the Device I/O APIs, see the Device I/O API 1.1 specification at:
Follow these steps to add the necessary API permissions for the previous example:
In a production environment, applications must be digitally signed in order to access peripherals. The use of digital signatures requires trusted certificates that are shared between both the NetBeans IDE and the embedded device.
The NetBeans IDE enables developers both to sign the applications with a local certificate and then upload that certificate to the device. Follow these steps: