Raspberry, a small computer powered by ARM architecture is a very interesting board for learning embedded system. The joy has not ended soon as Oracle also supported the board with their Java. In this article we will discuss about how to installing Java SE embedded on Raspberry Pi for running Java bytecode.
In this article I use:
- Slackware64 14.0
- Raspberry Pi Model B
- Soft-Float Debian Wheezy
- Java SE Embedded
For the installation of Operating System, you can follow this article.
Other things we should prepared:
- A wired network to which we can connect raspberry pi by an Ethernet cable. The network must supply DHCP IP address
A linux host computer on the same wired Ethernet network as Raspberry Pi to download JAVA. In this case I use Slackware64.
- Java runtime from Oracle.
- Enough free space to store Java SE Embedded on Raspberry Pi. 256MB is recommended.
Obtain the Materials
In this section we will use host (Slackware) to download Java SE Embedded and copy it over to the Raspberry Pi. Go to http://www.oracle.com/technetwork/java/embedded/downloads/javase/index.html. To download, you must agree to their license.
Choose Java SE Embedded 7, in this case I choose Java SE Embedded 7 for ARMv6/7 Linux – Headless EABI, SoftVFP ABI, Little Endian. At this time of writing, the version is 7u10 with size 31.39 MB. It is the first item on the list. Download it.
Oracle might ask for you to login. Just create an account if you don’t have any or login with your account if you have.
Login to Raspberry Pi over the network. The default username is pi with password raspberry. You can use ssh from terminalto do so. Open up another terminal and then copy the Java to pi using scp. Do extraction. You can also store Java on a directory such as /opt/java.
In this article I assume the host computer IP (Slackware64) is 192.168.1.113 and Raspberry IP’s is 192.168.1.114. Of course it would be different in your situation, but you can adjust it. The package is located on /home/xathrya/Downloads with name ejre-7u10-fcs-b18-linux-arm-vfp-client_headless-28_nov_2012.tar.gz.
For detailed command, you can read this commands.
# terminal 1
scp <strong>ejre-7u10-fcs-b18-linux-arm-vfp-client_headless-28_nov_2012.tar.gz</strong> email@example.com:/home/pi
# terminal 2
mv ejre*.gz /opt; cd /opt/java
tar -zxvf *.gz
# launch Java
mv ejre* ejre
That’s it. At this point, you should be able run Java code on your raspberry 😀