|Oracle® Java ME Embedded Getting Started Guide for the Reference Platform (Raspberry Pi)
This chapter describes installing the Oracle Java ME Embedded 8 software on the Raspberry Pi board, installing and using the Developer Agent program on the desktop host, configuring the Oracle Java ME Embedded system, connecting to the Raspberry Pi using a secure shell, and installing and running an Oracle Java ME Embedded application.
The following items are required for developing on the Raspberry Pi board:
Raspberry Pi Rev. B 512 MB board
Oracle Java ME Embedded 8 distribution
Micro-USB power supply of .7 or greater amps, and 5 volts. Note that the power supply must have a micro-USB type B connector, not a regular USB or mini-USB connector.
USB keyboard and mouse, as well as a monitor. If necessary for your monitor, use an HDMI-to-DVI video cable or adapter.
SD card of 4 GB or greater. An SD-HC class 10 card is recommended. Do not use a high-speed SD card, because it may be too fast for the Raspberry Pi board.
Ethernet cable with an RJ-45 connection, as well as a connection to a network with a DHCP server.
A terminal emulator program, such as PuTTY, if you wish to connect to the board using the Application Management System (AMS) interface.
Download the PuTTY terminal emulator program (
putty.exe) from the following site:
The terminal emulator executable file is directly downloadable as
putty.exe. The terminal emulator is used to connect to the AMS command-line interface (CLI) that sends commands to the board.
Using the PuTTY terminal emulator program is highly recommended. You can use any terminal program to connect to the CLI, however, Oracle cannot guarantee that other terminal programs work with the CLI in the same manner as PuTTY.
To develop applications on the Raspberry Pi board, you must first download and install the Wheezy variant of Raspbian Debian Linux on the Raspbian Pi board. To do this, follow these steps:
Download the Raspbian Wheezy hard-float (Debian Linux) raw image ZIP file to your desktop from the following site:
Unzip the distribution file, which creates a single disk image (
Mount the SD card to the desktop, and use a utility to write the disk image file to the SD card. Note that this is not the same as copying the file to the base-level directory on the SD card. Instead, it is similar to burning a disk image onto a CD-ROM or DVD-ROM. There are a number of utilities that will perform this action:
For the Windows operating system, you can use the Disk Image Writer utility located at
For the Mac platform, use the RPi-sd Card Builder located at
For Linux, use the
dd command. For more information, see
Eject or unmount the SD card from the desktop computer.
Connect the RJ-45 network cable, monitor, keyboard, and mouse.
Install the SD card in the Raspberry Pi board.
Connect power to the Raspberry Pi board. The red light on the Raspberry Pi board should glow, then in a few seconds, the green light should blink. The blinking green light indicates that the Raspberry Pi board is booting Linux.
If the Linux installation was successful, the Raspberry Pi board will start and obtain a DHCP address.
A configuration program (
raspi-config) runs, which helps you expand the file system partition on the SD card, configure the keyboard and time zone, reset the default password, and so on. Use the up and down arrow keys to make a menu choice. Use the left or right arrow keys to select OK or Cancel. Press
Return to run your choice. Note that the default user name is
pi, and the default password is
You can perform an update, start the
ssh server, and set the graphical desktop to automatically start, then click Finish. At this point, the board should reboot.
Log in if necessary, and if you are using the desktop, start an LXTerminal.
ifconfig command to display the Raspberry Pi IP address. This is necessary so you can access and control the board remotely. Remember this IP address; it will be used in the next set of steps.
Version 8 of the Oracle Java ME Embedded software contains a different architecture than previous versions. With version 8, the user has the option to run a Developer Agent program on the desktop under Windows. Commands that are sent to the board from the Windows desktop are no longer sent directly across the network. Instead, they are sent to the Developer Agent program, which transmits all communication to and from the Oracle Java ME Embedded executable file on the Raspberry Pi board.
The Oracle Java ME Embedded ZIP archive consists of the following directories:
/appdb: This directory is used on the Pi and contains internal Java libraries
/bin: This directory is used on the Pi and contains executables and the
/legal: This directory contains important legal documentation
/lib: This directory contains the files needed to compile IMlets on the Raspberry Pi board.
/util: This directory contains the Developer Agent program.
You must make two copies of the Oracle Java ME Embedded ZIP archive file. The first remains on the Windows desktop, while the second must be transferred to the Raspberry Pi board.
sftp client or
scp command to transfer one copy of the Oracle Java ME Embedded ZIP archive to the Raspberry Pi board. For example, on a UNIX or Mac system, you can transfer the ZIP file using a command similar to the following:
$sftp pi@[IP address of board]
Windows users can download the
psftp.exe to obtain a free SFTP client; it is available from the same address as the PuTTY executable:
After the ZIP archive is transferred, either go directly to the keyboard and the mouse connected to the Raspberry Pi board, or start a secure shell script on your desktop to connect to the board using the following command:
$ssh -l pi [IP address of board]
Unzip the archive on the Raspberry Pi board and perform the following command:
$chmod -R 755 appdb bin
cd to the
bin directory. The contents of the
bin directory are shown in Figure 1-1.
Figure 1-1 Raspberry Pi Bin Directory
If an HTTP proxy server is required for the Java IMlets on Raspberry Pi to make network connections (such as for HTTP or
apt-get), then Oracle Java ME Embedded on Raspberry Pi can be configured by adding the following lines to the end of the
com.sun.midp.io.http.proxy.host = proxy.mycompany.com com.sun.midp.io.http.proxy.port = 80