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:
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.
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
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.
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
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:
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.