Beaglebone Java Installation

I’m starting to work on a new project that brings together some of the work that I’ve done on previous installations.  One of the products that I’ve wanted to use is the Beaglebone Black.  I used the Raspberry Pi for lumenEssence but I found the SD card management a bit heavy.  Beaglebone seems to have some better traction in production deployments so I’m going to give it a try.  The first thing I need to do is get Java installed.

Let’s download it from Oracle:

$  wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u33-b05/jdk-8u33-linux-arm-vfp-hflt.tar.gz

Then we need to create the destination folder and unpack the distribution:

$ sudo mkdir /opt/jdk
$ sudo tar -zxf jdk-8u33-linux-arm-vfp-hflt.tar.gz -C /opt/jdk

Now let’s use linux alternatives to set the java targets:

$ sudo update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_33/bin/java 100
$ sudo update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_33/bin/javac 100

Check that you have your installation:

$ java -version

You should see something like this:

$ java -version
java version "1.8.0_33"
Java(TM) SE Runtime Environment (build 1.8.0_33-b05)
Java HotSpot(TM) Client VM (build 25.33-b05, mixed mode)

Now let’s test it out. Create a new class using Nano.

public class Test {
 public static void main(String[] args) {
 System.out.println("We made it!");
 }
}

Compile and run:

$ javac Test.java 
$ java Test
We made it!
$

Leave a Reply

Your email address will not be published. Required fields are marked *