I'm trying to get java (Java SE Embedded 6 http://www.oracle.com/technetwork/java/ ... index.html) running on Raspbian. However when I try and run it, I'm getting :
java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory
I've previously had this version running on Debian-Squeeze but I'm sure I didn't see this error. I'm sure I've the PATH and JAVA_HOME set correctly
Any ideas ?
BTW I'm not using openjdk because in tests for my application it was a lot slower.
Andy
Blog: http://ac31004.blogspot.co.uk/
- mpthompson
- Posts: 620
- Joined: Fri Feb 03, 2012 7:18 pm
- Location: San Carlos, CA
Re: Java on Raspbian
Andy, looking at what's available at that site, I don't see any binaries that are supported by Raspbian. The armv6 binaries use the soft float ABI (armel) which is incompatible with Raspbian. Even their armv7 binaries use the soft float ABI which I find a little curious, but there is probably a good reason for that from their perspective.acobley wrote:Any ideas ?
I live about two miles from the Oracle headquarters in Redwood Shores, CA and I would be happy to see what I could to help them create armv6 hard float ABI (armhf) binaries that would run under Raspbian, but someone would have to contact Oracle to see if there is interest on their behalf.
Re: Java on Raspbian
Thats a real shame !
I'll do some tests with openjdk but in the past I've found that a lot slower than the Oracle java. This could be quite a pain, may have to go back to the Debian image.
It would be nice f oracle would take some interest in the Pi.
Andy
I'll do some tests with openjdk but in the past I've found that a lot slower than the Oracle java. This could be quite a pain, may have to go back to the Debian image.
It would be nice f oracle would take some interest in the Pi.
Andy
- freedomotic
- Posts: 154
- Joined: Sat Apr 21, 2012 3:59 pm
- Location: Italy
Re: Java on Raspbian
Hi Andy,
the embedded oracle jvm isn't free? Do you know how much it's the required royalty?
We are doing some tests for our domotic framework and openjdk is very slow on raspi and debian wheezy.
Thanks
the embedded oracle jvm isn't free? Do you know how much it's the required royalty?
We are doing some tests for our domotic framework and openjdk is very slow on raspi and debian wheezy.
Thanks
Freedomotic Open IoT Framework
http://freedomotic.com
http://freedomotic.com
- mpthompson
- Posts: 620
- Joined: Fri Feb 03, 2012 7:18 pm
- Location: San Carlos, CA
Re: Java on Raspbian
I would encourage someone to take the initiative to contact Oracle and see what they have to say about creating a set of JRE binaries that support armv6+vfp. If the response was favorable, I would do what I could to help with such an effort. I've just got too much on my plate to do it myself right now. The chances of a positive response are pretty slim, but you never know where serendipity might take you.
- freedomotic
- Posts: 154
- Joined: Sat Apr 21, 2012 3:59 pm
- Location: Italy
Re: Java on Raspbian
Hi, do you have a reference (mail, person) to contact in Oracle?
Have you ever try to contact them?
Have you ever try to contact them?
Freedomotic Open IoT Framework
http://freedomotic.com
http://freedomotic.com
Re: Java on Raspbian
You'll likely find better performance with cacaovm if you're able to use it. See these performance measurements by Xerxes Ranby: https://docs.google.com/spreadsheet/oim ... o09v1y3q53
We (the Raspberry Pi Foundation) have been in contact with Oracle and other JVM providers.
We (the Raspberry Pi Foundation) have been in contact with Oracle and other JVM providers.
Re: Java on Raspbian
So, out of interests, what would the Java jvm need to be compiled with ? I note that Java SE Embedded 6 on ARM EABI, Little-Endian, Linux is compiled with the options :
gcc options used include: -mfloat-abi=softfp -mfpu=vfp
Andy
gcc options used include: -mfloat-abi=softfp -mfpu=vfp
Andy
Re: Java on Raspbian
The main problem with openjdk(6) on raspbian is that the JIT compiler doesn't seem to work. With the icedtea-6-jre-cacao package installed, you are supposed to be able to enable the Cacao JIT with "java -cacao", but when I attempt this (on almost any of my code) the JVM crashes. I suspect that if the Cacao JIT could be fixed then openjdk would be quite usable. Also, openjdk7 is supposed to offer some performance improvements, but this isn't yet in the raspbian repos.
Re: Java on Raspbian
Why don't you use JAMVM? This vm is often used in large scaled embedded projects. Memory efficient and fast at ARM platforms 
best regards,
jan

best regards,
jan
Re: Java on Raspbian
There doesn't appear to be any "jamvm" in the raspbian repos.
Re: Java on Raspbian
It looks like you may have to build it. See the JamVM site here.
Jam games and post-mortems: stevepdp.dev/games.html
- mpthompson
- Posts: 620
- Joined: Fri Feb 03, 2012 7:18 pm
- Location: San Carlos, CA
Re: Java on Raspbian
Java is a place where Raspbian could really use help from people in the Raspberry Pi community who have an interest in Java. There are similar issues with Mono as well. Hopefully some very experienced Java developers can examine the Debian openjdk package and other Java related packages and tell us what changes need to be made to the build configurations to improve Java support. Plugwash and I try to do the best we can, but our experience with Java is very limited and our ability to really test and optimize the builds is limited as well.
Re: Java on Raspbian
That is because it came out contaiminated with armv7 code and I didn't have the time/inclination to figure out why.darrenjw wrote:There doesn't appear to be any "jamvm" in the raspbian repos.
-
- Posts: 192
- Joined: Sun Dec 25, 2011 5:25 pm
- Location: Edinburgh, UK
Re: Java on Raspbian
How do you determine if a binary has armv7 code lurking in it?plugwash wrote: That is because it came out contaminated with armv7 code and I didn't have the time/inclination to figure out why.
Re: Java on Raspbian
We have a script that calls readelf on every file in the package and checks for claims of armv7.
It's not a perfect system, there can be both false positives (e.g. code that does runtime CPU detection) and false negatives (e.g. JIT compilers) but it does keep the majority of v7 code out of our repo.
http://pastebin.com/BtSdvrXM
uncomment the "echo $filename" to determine which files are contaminated.
It's not a perfect system, there can be both false positives (e.g. code that does runtime CPU detection) and false negatives (e.g. JIT compilers) but it does keep the majority of v7 code out of our repo.
http://pastebin.com/BtSdvrXM
uncomment the "echo $filename" to determine which files are contaminated.
- mpthompson
- Posts: 620
- Joined: Fri Feb 03, 2012 7:18 pm
- Location: San Carlos, CA
Re: Java on Raspbian
We have scripts that run 'readelf -A' on the resulting binaries from any build. This tool will indicate whether armv7 code is present in any of the code segments within the file. With Java things are a bit trickier in that the JIT generates executable code at runtime. Some JITs will dynamically detect the CPU environment and automatically adjust the instructions as needed to run on the CPU, but most will simply generate code for the CPU they were configured for. Finally, many JITs don't know how to generate armv6 instructions and will default to armv5 (a more popular platform) if they can't generate armv7 and thus loose the ability to use hard float instructions. Things are kind of a mess on ARM platforms because of so many different CPU variants with different capabilities.ksangeelee wrote:How do you determine if a binary has armv7 code lurking in it?
Re: Java on Raspbian
Hmm, but isn't it compatible with fp emulation? Is the optimization for arm7 the target or to get java run at raspbian?
Re: Java on Raspbian
Well I'll have a go at compiling the JamVM and see if I can get it working.
Andy
Andy
Re: Java on Raspbian
well the good news is it's quite easy to get JamVM running on the PI. I just downloaded the source, configure, make and make install.
The bad news is it doesn't look like it will run my application, trying to start cassandra gives:
Unrecognised command line option: -javaagent:/home/space/apache-cassandra-1.1.0/bin/../lib/jamm-0.2.5.jar
It looks like JamVM doesn't support Java Agents:
http://java.sun.com/developer/technical ... SE/jvm_ti/
Andy
The bad news is it doesn't look like it will run my application, trying to start cassandra gives:
Unrecognised command line option: -javaagent:/home/space/apache-cassandra-1.1.0/bin/../lib/jamm-0.2.5.jar
It looks like JamVM doesn't support Java Agents:
http://java.sun.com/developer/technical ... SE/jvm_ti/
Andy
Re: Java on Raspbian
hey Andy,
jamVM has some restrictions at low level platforms. Agents AND class proxies (used for various testing frameworks such as TestNG, JUnit etc.) won't work. But that's documented.
All the "standard" reflections work fine.
Hope that helps.
jamVM has some restrictions at low level platforms. Agents AND class proxies (used for various testing frameworks such as TestNG, JUnit etc.) won't work. But that's documented.
All the "standard" reflections work fine.
Hope that helps.
Re: Java on Raspbian
Just as note: We have full blown OSGI's (knopflerfish 1.3 and 4) running at arm5 platforms with jamvm. Using thread pools, heavy reflections and of course some native stuff 

Re: Java on Raspbian
Thanks Jan77.
I'll investigate and see if jamm-0.2.5.jar is absolutely needed for Apache Cassandra.
Andy
I'll investigate and see if jamm-0.2.5.jar is absolutely needed for Apache Cassandra.
Andy
-
- Posts: 4
- Joined: Fri Jun 01, 2012 7:46 am
- Location: Woking, Surrey
Re: Java on Raspbian
+1 to this issue.
I am currently developing a library for full use of the GPIO header with Java. The full focus of my work on the Pi is with Java and with the best will in the world, the OpenJDK just doesn't measure up to the Oracle one in terms of performance. So, I was thrilled when their ARMv6 binary release worked flawlessly (and very fast) with Debian. The lack of compatibility with Raspbian is a big loss. I will be writing to Oracle to ask if they can produce a hard float version of the binary, but I am not hopeful. For one, they may well have good technical reason not to produce one. Secondly, its understandable that as a business they may not find a case to spend time on supporting a hobbyist community, if that's their only reason to produce a new release.
As I don't fully understand the fine points of compilation for soft/hard FP, I have to ask: since the Debian release runs the OracleJRE flawlessly, isn't it possible to make Raspbian run it as well? Does the kernel boot the CPU into a fundamentally different mode that it cannot accept the soft FP instructions? What's stopping it from running where Debian armel had no issues?
I am currently developing a library for full use of the GPIO header with Java. The full focus of my work on the Pi is with Java and with the best will in the world, the OpenJDK just doesn't measure up to the Oracle one in terms of performance. So, I was thrilled when their ARMv6 binary release worked flawlessly (and very fast) with Debian. The lack of compatibility with Raspbian is a big loss. I will be writing to Oracle to ask if they can produce a hard float version of the binary, but I am not hopeful. For one, they may well have good technical reason not to produce one. Secondly, its understandable that as a business they may not find a case to spend time on supporting a hobbyist community, if that's their only reason to produce a new release.
As I don't fully understand the fine points of compilation for soft/hard FP, I have to ask: since the Debian release runs the OracleJRE flawlessly, isn't it possible to make Raspbian run it as well? Does the kernel boot the CPU into a fundamentally different mode that it cannot accept the soft FP instructions? What's stopping it from running where Debian armel had no issues?
- mpthompson
- Posts: 620
- Joined: Fri Feb 03, 2012 7:18 pm
- Location: San Carlos, CA
Re: Java on Raspbian
The issue not with the CPU, but with all code on the system expecting to call each other using the hard float ABI (application binary interface) as opposed to the soft float ABI. It's a matter of conventions that all the software on the system agrees to. The reason for the different ABI's is best explained in this Debian document:Augmental_UK wrote:As I don't fully understand the fine points of compilation for soft/hard FP, I have to ask: since the Debian release runs the OracleJRE flawlessly, isn't it possible to make Raspbian run it as well? Does the kernel boot the CPU into a fundamentally different mode that it cannot accept the soft FP instructions? What's stopping it from running where Debian armel had no issues?
http://wiki.debian.org/ArmHardFloatPort
Up until the Raspberry Pi, there was no compelling reason for vendors such as Oracle to create a version of Java compiled for armv6+vfp with the hard float ABI. With asb mentioning above that the Foundation is in touch with JVM vendors, perhaps this will change.
Until then, the Debian Wheezy armel build is available to run Java on, but it won't benefit from hardware floating point instructions.