This chapter contains the following topics:
Installing the Raspbian Pi Operating System on the Raspberry Pi Board
Preparing Raspberry Pi Board for Working With an Embedded Display
Installing the Oracle Java ME Embedded Software Using the Java ME SDK
Adding an HTTP Proxy for Network Connections on Raspberry Pi
Downloading and Installing the PuTTY Terminal Emulator Program
This section describes the hardware and software items that are required for developing on the Raspberry Pi board.
Raspberry Pi 2, Raspberry Pi Rev. B or Rev. B+ 512 MB board
Oracle Java ME Embedded 8.3 distribution or Oracle Java ME SDK 8.3
Note:
You have two options to work with the Raspberry Pi board: with or without using the Java ME SDK. You can use the Java ME SDK to setup your Raspberry Pi device or download the Oracle Java ME Embedded distribution and install it manually.
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, mouse, and 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 connector, 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.
Note:
Oracle Java ME 8.3 supports working with any embedded display with the frame buffer interface such as Adafruit PiTFT 3.5" Touch Screen for Raspberry Pi.
To develop applications on the Raspberry Pi board, you must first download and install the Raspbian operating system (based on Debian Wheezy) on the Raspberry Pi board. Note that if you want to use the embedded display, you must download the customized operating system image. For more information, see Preparing Raspberry Pi Board for Working With an Embedded Display.
To install the Raspbian Pi operating system, follow these steps:
.img
) file.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)
.
To prepare the Raspberry Pi board for work, follow these steps:
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
.ssh
server, and set the graphical desktop to automatically start, then click Finish. At this point, the board should reboot.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 for further use.Oracle Java ME 8.3 supports working with any embedded display with the frame buffer interface such as Adafruit PiTFT 3.5" Touch Screen for Raspberry Pi.
This section explains how to prepare your board for working with the embedded display and contains the following topics:
Attach the embedded display using the high speed SPI interface on the Raspberry Pi board. For more information, see the manufacturer's site at
https://learn.adafruit.com/adafruit-pitft-3-dot-5-touch-screen-for-raspberry-pi/overview
Download the customized Raspbian based raw image ZIP file to your desktop from the following site:
https://learn.adafruit.com/adafruit-pitft-3-dot-5-touch-screen-for-raspberry-pi/easy-install
Install the image into the Raspberry Pi board as described in Installing the Raspbian Pi Operating System on the Raspberry Pi Board.
After you installed the customized operating system image, you must re-install the Java ME Embedded software using one of the following procedures:
Starting from version 8, the Oracle Java ME Embedded software contains a different architecture than previous versions. The user has an option to run a Developer Agent program on the desktop under Windows or Linux. Commands that are sent to the board from the host 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 Raspberry Pi and contains internal Java libraries.
/bin
: This directory is used on the Raspberry 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.
This section describes how to install the Oracle Java ME Embedded Software on the Raspberry Pi board using the Oracle Java ME SDK. If you want to manually install the Java Embedded Software, see Installing the Oracle Java ME Embedded Software Manually.
Install the Oracle Java ME SDK 8.3. For complete instructions, see Oracle Java ME SDK Developer's Guide.
Start the Oracle Java ME SDK Device Connections Manager located in the <SDK Installation Folder>/bin
directory and click its icon in the system tray. A Device Connections Manager window is shown in Figure 1-1.
Figure 1-1 Device Connections Manager Window
[画像:Description of Figure 1-1 follows]Press Ctrl+N or click the Setup new device button on the toolbar.
Select the Raspberry Pi radio button and click Next. The Setup New Device window is shown in Figure 1-2.
Figure 1-2 Setup New Device Window
[画像:Description of Figure 1-2 follows]In the IP Address or Host Name, enter the IP address of the Raspberry Pi board, in the User Name and Password fields, enter the user name and password. Click Next.
Choose the installation folder. By default, the Java ME Runtime is installed in the /home/pi/javame8.3
directory.
Check the Start Java ME Runtime Now and Start Java ME Runtime on Boot check boxes and click Finish.
The Raspberry Pi device is now registered and has the Connected status in the Device Connections Manager window as shown in Figure 1-3.
Figure 1-3 Device Connections Manager Window with Raspberry Pi Connected
[画像:Description of Figure 1-3 follows]This section describes how to install the Oracle Java ME Embedded Software manually. Download the Oracle Java ME Embedded ZIP archive file and follow these steps:
sftp
client or scp
command to transfer a copy of the Oracle Java ME Embedded 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 which is available from the same address as the PuTTY executable:
$ssh -l pi [IP address of board]
bin
directory.
bin
directory are shown in Figure 1-4.
Figure 1-4 Raspberry Pi Bin Directory
[画像:Description of Figure 1-4 follows]fix_permission.sh
script to enable a privilege escalation mechanism.
pi@raspberry ~/bin $ fix_permission.sh
fix_permission.sh
provides the following functionality:
Sets an executable mode for all .sh
files
Sets an executable mode for the runMidlet
Sets the network capabilities for the runMidlet
by granting superuser privileges to perform various network-related operations
Enables the runMidlet
to access the files required for the Device I/O functionality
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 configure Oracle Java ME Embedded on Raspberry Pi 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
The PuTTY terminal emulator is used to connect to the AMS command-line interface (CLI) that sends commands to the board.
Download the PuTTY terminal emulator program (putty.exe
) from the following site:
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.
Scripting on this page enhances content navigation, but does not change the content in any way.