Java on BBB

This deploys openJDK 6 on beaglebone black.

I could not get this to install successfully on the shipping image.
I flashed my board with BBB-eMMC-flasher-2013.05.08 then tried installing all of the following packages as recommended in another post on this forum, but encountered several issues.

openjdk-6-common

openjdk-6-demo

openjdk-6-doc

openjdk-6-java

openjdk-6-jdk

openjdk-6-jre

openjdk-6-source

openjdk-6-vm-cacao

openjdk-6-vm-jamvm

openjdk-6-vm-zero

These are the packages I installed in the order I installed them.
openjdk-6-common

openjdk-6-java

openjdk-6-jre

openjdk-6-jdk

openjdk-6-vm-jamvm

The vm-zero package would not install due to a dependency issue (libffi5 >= 3.0.10)
and vm-cacao installed without errors but a VM would not start

This deploys openJDK 6 on beaglebone black.

I could not get this to install successfully on the shipping image.
I flashed my board with BBB-eMMC-flasher-2013.05.08 then tried installing all of the following packages as recommended in another post on this forum, but encountered several issues.

openjdk-6-common

openjdk-6-demo

openjdk-6-doc

openjdk-6-java

openjdk-6-jdk

openjdk-6-jre

openjdk-6-source

openjdk-6-vm-cacao

openjdk-6-vm-jamvm

openjdk-6-vm-zero

These are the packages I installed in the order I installed them.
openjdk-6-common

openjdk-6-java

openjdk-6-jre

openjdk-6-jdk

openjdk-6-vm-jamvm

The vm-zero package would not install due to a dependency issue (libffi5 >= 3.0.10)
and vm-cacao installed without errors but a VM would not start

How did you attempt to start it and what was the output?

Unfortunately I didn’t capture the error messages.

I tried to test a java application by invoking the class, i.e.; java -classpath .:/bin/* TheClass. I next tried to compile a simple helloworld file with javac, this produced a list of errors with memory addresses, again, I didn’t capture the errors. If I get a chance I’ll remove the jamvm package and reinstall/test the cacao package and post the exact output.

You can try the Oracle JVM (for ARM) : http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
There is a tar.gz file that you deflate where you want.

I use this JVM on the “first gen” beaglebone … and it should be ok en the BBB. The Oracle JVM is (a lot) more performant than the zeroVM, JamVM or CacaoVM.
I made some tests on Raspbery & Beaglebone : http://parleys.com/play/5156c4d6e4b0c779d7881405/chapter24/about and http://parleys.com/play/5156c4d6e4b0c779d7881405/chapter25/about

I tried the Oracle jdk on the shipping image with no luck. Have not tried on the 0508 image. If someone has success please post.

The oracle should work depending on the abi you are running. Is your system running soft float abi OS or is it hard float abi OS.? If soft based then download the 7u6 else download the ea 8 version.

Interesting note Gary. I am running the 0508 Angstrom image, having replaced the shipping version. The described behavior was observed on the shipping version. Perhaps someone familiar with Angstrom distros can comment definitively on the soft/hard abi issue.

I have tried successfully the Oracle embedded JRE 6&7 and the “standard” JDK 7 on beaglebone with various angstrom image (Soft Float version).
With ubuntu (hard float) on beaglebone, I have tried successfully the JDK 8ea version.

You say that you have no luck … but is there any errors on your system ? Which JVM version do you use ?

Laurent

Just download the tar.gz file on the Oracle site : http://www.oracle.com/technetwork/java/javase/downloads/index.html and detarred the file on your SD card.
(The ARM version)
Put the bin directory on your PATH and you should be able to run yout Java program.

Laurent

I’m really puzzled. I’ve no problem gettig java to run on the beaglebone black, but I can’t find an implementation for com.oracle.deviceaccess.* I would like to reference a GPIOPin.class from my java code and manupulate it directly. Anybody any clues? I’m pulling my hair out here…

That’s a Java ME class, and I expect you’re running Java SE aren’t you? There’s no reason that I’m aware of to run the micro-edition on hardware like the BBB, it’s easily got enough grunt to run the full JVM.

I’m accessing GPIO, I2C, SPI from J2SE using JNA (https://github.com/twall/jna) which is working very well - it’s a wrapper around libc, much easier to work with than JNI, and because it’s just libc wrapped in Java you can do anything you can do in C - in particular, you can poll() on filehandles, which means you can use the GPIOs through the /sys/class/gpio interface.

To preempt the next question, I’ve extracted a bit of code and put it as a shar archive at http://pastebin.com/af3CRU5r. Download the raw content to a shell script and run it, it will give you 5 Java source files. Compile them with the “jna.jar” file from ther JNA project mentioned above. This is an extract from a project I’m working on so in order to use it you’d need to fill in a couple of blanks, namely the events that are being fired when the GPIO changes value: search for “pubGPIO” to see where that happens. I’m also using the GPIO overlays from https://github.com/nomel/beaglebone to set pull-ups/pulldowns, although this isn’t essential to the classes. The I2C stuff is there for good measure but is also independent. And if you want to do things completely differently, the POSIX.java file is my way into libc via JNA, and doesn’t depend on anything else.

Hi Mike,

Excellent post, this really cleared a lot for me. Great time to experiment with this over the holidays. Much appriciated., Gijs