Quickie Guide Getting Hard-Float Enabled Java Embedded Running on Raspberry Pi

Here's the Quickie Guide in getting the hard-float version of JDK 8 for ARM Early Access running on your Raspberry Pi, and how to compile on the device!

1. Download the Win32DiskImager if you are on Windows, or if your are on a Mac/Linux PC skip this download and use dd instead:

2. Download the RPi Hard-Float Debian Wheezy image from here:

3. Insert a blank SD Card (NOTE: Only use a SD Card from this list) into your Windows or Mac/Linux PC.

4. Use Win32DiskImager on a Windows PC (or on Mac/Linux use "sudo dd if=<path_to_raspian.img> of=/dev/[diskNN|sdd] bs=[1m|4m]" or similar command see: dd ref) to burn the unzipped image from #2 to the SD Card.
(NOTE: After burning the SD Card, it will say the size is ~55MB (or something small like that). That's supposed to be that way and is OK, since the SD Card was imaged to have a swap area on it)

5. Insert the SD Card into your RPi. Connect an Ethernet cable from your RPi Ethernet port to your network. Connect the RPi Power Adapter. (NOTE: Make sure to use your RPi Power Adapter and do not use the USB port of a computer, since only the RPi Power Adapter will have enough current to drive your RPi and the SD Card)

6. The RPi will boot onto your network. Find its IP address by referring to your network DHCP settings or by using Windows Wireshark or the Mac/Linux tcpdump command:
  sudo tcpdump -vv -i[en0|en1|eth0|eth1] port 67 and port 68

7. Download JDK 8 for ARM Early Access (with Hard-Float support):
  NOTE: First click the "Accept License Agreement" button, then choose:
    Linux ARMv6/7 VFP, HardFP ABI "tar.gz" under the "JDK" column

8. scp the bundle from step #7 to your RPi:
   scp <jdk8-zip-bundle> pi@<ip_addr_rpi>:/home/pi
   <Password: "raspberry">

9. ssh to your RPi:
  ssh <ip_addr_rpi> -l pi
  <Password: "raspberry">

10. Untar the bundle from step #8 and rename (move) the toplevel directory to /usr/local/java
   cd /home/pi
   tar zxvf jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012.tar.gz
   sudo mv jdk1.8.0 /usr/local/java
   export PATH=$PATH:/usr/local/java/bin
   java -version
11. Compile on your device!
   cd /home/pi
   cat > HelloWorld.java
   public class HelloWorld {
     public static void main(String args[]) {
       java.lang.System.out.println("Hello World!");
   javac HelloWorld.java
   java -cp . HelloWorld

Yay! You have the JDK 8 for ARM Early Access (with hardware floating point support!!) on your RPi and can compile Java apps on your device!


How do I execute a jar file?

Posted by guest on December 26, 2012 at 12:40 PM PST #

To execute a JAR file:

1. Put the following line permanently in your ~/.bashrc file:
vi ~/.bashrc
# Add this line:
export PATH=$PATH:/usr/local/java/bin

2. Exit ssh, ssh back into your RPi, then run this Java command to execute a single JAR file that has the main class already defined in it:

java -jar JarFileName.jar

Or, if you don't have the main class defined in the JAR file:

java -cp [path-to-JarFileName.jar] [MainClassName]

Or, if you have multiple JAR files:

java -cp [path-to-JAR1]:[path-to-JAR2]:[path-to-JARnn] MainClass


Posted by Hinkmond Wong on December 26, 2012 at 01:09 PM PST #


I'm a bit confused. Is this really a Java Embedded build (like the ones you get from http://www.oracle.com/technetwork/java/embedded/downloads/javase/index.html) or is it a normal Java for ARM? If so, is a hardfloat Java for Embedded build planned to be released someday?


Posted by guest2 on December 26, 2012 at 06:08 PM PST #

Hi guest2,

In the above blog post, this hard-float enabled build of Java Embedded is different than the ejre (Embedded Java Runtime Environment) 7 that you point to with your URL, since this new hard-float enabled ARM build is an early access of the JDK 8 for ARM (not the final release of the Embedded Java Runtime Environment for Java SE 7 on ARM that you pointed to). So, that's the main difference: this is an Early Access of the future JDK 8 product (not just the runtime) of a future upcoming release (not the older existing final release of Java SE Embedded 7 runtime for ARM).

And, this is the first time you are seeing the javac compiler in this bundle since it is a JDK 8 build (not just a JRE build). So, that's also a major difference. And, we don't make any guarantees (this is not a promise of future functionality), but you should watch for hard-float support also in the ejre for Java SE Embedded 7 at some point also. For now, if you want hard-float support on the RPi for ARM it's best to use the JDK 8 for ARM Early Access bundle that this blog post talks about.


Posted by Hinkmond Wong on December 26, 2012 at 06:34 PM PST #

Post a Comment:
Comments are closed for this entry.

Hinkmond Wong's blog on making the Internet of Things (IoT) smarter with Java Technology and Artificial Intelligence (AI)


« February 2016