Oracle® Java ME Embedded Getting Started Guide for the Reference Platform (Raspberry Pi) Release 8.1 E48512-04 |
|
![]() Previous |
![]() Next |
This chapter describes installing the Oracle Java ME Embedded 8.1 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 or Rev. B+ 512 MB board
Oracle Java ME Embedded 8.1 distribution
Micro-USB power supply of 0.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.
NOTE: 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 (.img
) file.
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 https://launchpad.net/win32-image-writer
.
For the Mac platform, use the RPi-sd Card Builder located at http://alltheware.wordpress.com/2012/12/11/easiest-way-sd-card-setup
.
For Linux, use the dd
command. For more information, see http://en.wikipedia.org/wiki/Dd_(Unix)
.
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 raspberry
.
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.
Run the ifconfig
command to display the Raspberry Pi IP address. This is necessary so that you can access and control the board remotely. Remember this IP address; it will be used in the next set of steps.
Starting from version 8, 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 jwc_properties.ini
file
/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.
Use an sftp
client or scp
command to transfer a 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.
cd
to the bin
directory. The contents of the bin
directory are shown in Figure 1-1.
Run the fix_permission.sh
script to enable a privilege escalation mechanism.
pi@raspberry ~/bin $ fix_permission.sh
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 bin/jwc_properties.ini
file:
com.sun.midp.io.http.proxy.host = proxy.mycompany.com com.sun.midp.io.http.proxy.port = 80