Page 3 of 5

Re: Java on Raspbian

Posted: Sat Aug 18, 2012 1:08 am
by rlougher
rlougher wrote: Once I've checked the changes into JamVMs GIT tree, I'll let Xerxes Randby know. Hopefully they'll then end up in IcedTea sometime...
Sorry for the delay, but the JamVM changes for Raspbian have made it into IcedTea. Here's the changeset for IcedTea6:

http://icedtea.classpath.org/hg/icedtea ... d3d110abfe

And the one for IcedTea7 (this took extra time as the latest OpenJDK 7 update contains changes that required extra work):

http://icedtea.classpath.org/hg/icedtea ... dfd32d5674

The actual commit to JamVMs GIT repository for the Raspbian changes is here (done 25th July):

http://git.berlios.de/cgi-bin/gitweb.cg ... 2bf15758c5

Re: Java on Raspbian

Posted: Sat Aug 18, 2012 1:30 am
by rlougher
dacha wrote:
plugwash wrote:
rlougher wrote: A couple of minor changes are needed to get JamVM to work on raspbian (when I ported JamVM to armhf, I took the opportunity to use thumb2, as armhf specified this as a minimum requirement). Hopefully I'll check these changes in tonight.
Can you provide us a link to the patch, it would be good to be able to re-enable jamvm in our openjdk packages.
No need for a patch. The only problem JamVM has is that its own JNI invocation mechanism through src/os/linux/arm/callNativeEABI.S doesn't work correctly on Raspbian's hardfp ABI. But JamVM also supports using libffi as an alternative JNI mechanism, which works fine. You enable it as follows:

Code: Select all

./configure --enable-ffi
To clarify. JamVM has hand-written assembler for most platforms for calling JNI methods according to the platform ABI. It also supports using libffi to call JNI methods in a platform independent manner (as libffi handles all the platform details). By default, JamVM uses the hand-written routines as these are much faster than using libffi. On armhf, this is src/os/linux/arm/callNativeEABIHard.S (src/os/linux/arm/callNativeEABI.S is for armel). As armhf was previously only used on ARMv7, I used thumb2. For Raspbian, I have introduced yet another variant src/os/linux/arm/callNativeEABIHardARM.S which as the name suggests supports the EABI hard float ABI but is written in ARM mode so it works on ARMv6 processors such as in the Raspberry Pi. For other armhf targets the original routine is still used, as being thumb2 it is smaller, and (slightly) faster.

Re: Java on Raspbian

Posted: Tue Aug 21, 2012 12:45 pm
by ota-kun
Are there any news on the progress concerning an Oracle hard float VM?

Btw.: I'm willing to volunteer as beta tester.

Re: Java on Raspbian

Posted: Tue Aug 21, 2012 8:33 pm
by mpthompson
I am scheduled to visit Richard at Oracle on Thursday afternoon. It sounds like they are making progress, but I don't know the specifics at this time. The best I can say right now is stay tuned.

Re: Java on Raspbian

Posted: Wed Aug 22, 2012 5:49 pm
by rfincher1
This is from Henrik Stahl at Oracle:

" One caveat is that the current binary is softfloat ABI only, so it won't work with (for example) the Raspbian distribution which uses the hardfloat ABI. We are planning to add hardfloat support in an upcoming JDK release, as well as support for JavaFX on ARM."

Looks like light at the end of the tunnel! They are talking about Raspberry Pi and Raspbian by name, so that's a very good sign.

See the full post at:

https://blogs.oracle.com/henrik/entry/o ... _for_linux

Rick

Re: Java on Raspbian

Posted: Thu Aug 23, 2012 3:31 pm
by pithonica
Some comments on schedule in that blog post:

"The initial release of the Oracle JDK for ARM uses the softfloat ABI and so works on softfloat distributions, or hardfloat with softfloat compatibility, but not on hardfloat. This is just a matter of timing - we will provide a hardfloat JDK at some point in the future. It will likely be done iteratively, so we may for instance deliver ARMv7 first and ARMv6 later, and the initial release may be headless so no Swing/AWT. We will produce public early access builds as soon as we are able and make them available on java.net. We don't have any dates to share yet, but will hopefully be able to provide a roadmap at JavaOne 2012."

Re: Java on Raspbian

Posted: Fri Aug 24, 2012 3:44 am
by mpthompson
I had a terrific meeting with Richard Bair at Oracle today to discuss their progress on an official Java VM that would support the Raspbian flavor of armhf. I was very pleased to see working projects with optimized VMs that I believe greatly demonstrate the potential of Java on the Raspberry Pi. There seems to be genuine excitement on his team about the capabilities of Java running on such an inexpensive, yet very capable device. Particularly the educational potential which is in perfect alignment with the goals of the Raspberry Pi Foundation.

Unfortunately, I really can't go into any timelines because much of it is still being worked out (and it would be inappropriate to say anything anyway). Richard indicated that for now nothing is official and that a roadmap for Oracle officially supporting Java on the Raspberry Pi with Raspbian armhf may be announced at the JavaOne conference in about 5 weeks from now. I'll keep my fingers crossed that timelines and commitments are clarified at that time and that we'll see an official release from Oracle at some point in the future.

In the meantime, the Oracle Java VM is supported on the Raspberry under Debian armel.

Re: Java on Raspbian

Posted: Wed Aug 29, 2012 11:56 pm
by belgaroo
I also need this.

Once the gods have solved the issue I would be happy to write up a recipe to get an example application running on the pi.

Thanks to the Java team for taking an interested- much appreciated!

Re: Java on Raspbian

Posted: Thu Aug 30, 2012 1:55 pm
by uberscubajim
Can I just ask a really stupid question here.

The processor on the Pi supports the Java instruction set via the Jazelle extension. Is there a reason that this isn't being used?

I know that this is quite an academic question but it does seem odd to have that hardware support and then not use it.

Jim.

Re: Java on Raspbian

Posted: Thu Aug 30, 2012 3:17 pm
by v6ak
As far as I know:
* Jazelle is not very fast. Modern JIT (consumes more RAM) or AOT (ahead of time compiler, needs cache for fast start) perform often better.
* It may need J2ME StackMap and old JVM bytecode version, but I am not sure.
* It requires implementation of those instructions; it is just an optimized interpreter.
* There is neither any free-of-charge nor any opensource implementation of JVM vith Jazelle.
* Jazelle is not likely to be supported in future ARM processors, since there is ThumbEE in future ARM processors.

Re: Java on Raspbian

Posted: Thu Aug 30, 2012 6:25 pm
by Kidikarus
Jan77,

Have you had any further luck on getting your knoplerfish onto the pi? Do you have a lessons learned from your arm5 effort? We use Virgo and I am guessing its a similar process.

Re: Java on Raspbian

Posted: Fri Sep 14, 2012 6:00 pm
by Jim Manley
liz wrote:NoisebridgeOracle: The JavaFX engineering team will be coming along to demonstrate Java and JavaFX running on the Raspberry Pi
This will be the Foundation-sponsored hackerspace visit by Rob Bishop on 29 September in San Francisco. Will Mike Thompson of Raspbian, Richard Bair of Oracle, or others involved in their efforts be at the Noisebridge, Hacker Dojo (Mountain View), or Stanford events (the latter two will be on 30 September and 1 October, respectively)? I plan to attend all three to help demo things, show an Atrix lapdock PiTop, and make attendees aware of the monthly Silicon Valley Raspberry Jams and Peninsula Raspberry Pi Meetup group.

Re: Java on Raspbian

Posted: Fri Sep 14, 2012 11:36 pm
by mpthompson
I guess I better start making my plans now to attend. All three are within easy driving distance for me, but I need to check for calendar conflicts.
Jim Manley wrote:
liz wrote:NoisebridgeOracle: The JavaFX engineering team will be coming along to demonstrate Java and JavaFX running on the Raspberry Pi
This will be the Foundation-sponsored hackerspace visit by Rob Bishop on 29 September in San Francisco. Will Mike Thompson of Raspbian, Richard Bair of Oracle, or others involved in their efforts be at the Noisebridge, Hacker Dojo (Mountain View), or Stanford events (the latter two will be on 30 September and 1 October, respectively)? I plan to attend all three to help demo things, show an Atrix lapdock PiTop, and make attendees aware of the monthly Silicon Valley Raspberry Jams and Peninsula Raspberry Pi Meetup group.

Re: Java on Raspbian

Posted: Sun Sep 23, 2012 12:48 am
by xranby
I have great results using JamVM on Raspbian in combination with OpenJDK especially well suited for applications using Java2D and OpenGL ES 2.
http://www.raspberrypi.org/phpBB3/viewt ... 91#p177791

This Raspbian compatible JamVM is included in the last IcedTea 7 2.3.1 release and the 2.3.2 that contains all the recent Java 7 security fixes.
It would be beneficial if JamVM got built and shipped by default possibly by re-building the latest Ubuntu OpenJDK 7 package on Rasbian.
https://launchpad.net/ubuntu/+source/openjdk-7
This 2.3.2a package also contains one extra patch for JamVM that is currently not found in IcedTea or JamVM upstream to make JamVM match the libjvm.so SONAME used by hotspot.
http://bazaar.launchpad.net/~ubuntu-bra ... evision/30
This enables the OpenJDK 7 libjava.so to find the jamvm libjvm.so out of the box.

For the OpenJDK 6 package you may use this patch
http://icedtea.classpath.org/hg/icedtea ... 1137cef484
to use the latest JamVM in combination with IcedTea6 1.11.x before the next IcedTea 6 1.12 hits the streets.

Quick manual JamVM build instructions for OpenJDK-6 http://labb.zafena.se/?p=576

Re: Java on Raspbian

Posted: Mon Sep 24, 2012 10:01 pm
by plugwash
dacha wrote: Since you manage the repository, let me report that the CACAO JVM already in that repository definitely isn't clean, as all it takes to crash it is this:
mmm, thanks for providing a crash recipe, I can reproduce your crash.

It's not a raspbian specific issue though. Debian armhf on my beagleboard XM has the same problem.

bugs filed in debian.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=688702
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=688703

Re: Java on Raspbian

Posted: Tue Sep 25, 2012 9:24 am
by xranby
plugwash wrote: It's not a raspbian specific issue though. Debian armhf on my beagleboard XM has the same problem.

bugs filed in debian.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=688702
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=688703
Thank you or the bugreports i will forward them to the CACAO maintainer Stefan Ring.
We will soon update CACAO in IcedTea6 to include the CACAO 1.6.0 release that brings in some more bugfixes.
xranby wrote:It would be beneficial if JamVM got built and shipped by default possibly by re-building the latest Ubuntu OpenJDK 7 package on Rasbian.
https://launchpad.net/ubuntu/+source/openjdk-7
This 2.3.2a package also contains one extra patch for JamVM that is currently not found in IcedTea or JamVM upstream ...
For the OpenJDK 6 package you may use this patch
http://icedtea.classpath.org/hg/icedtea ... 1137cef484
This fix is now in JamVM upstream:
http://mail.openjdk.java.net/pipermail/ ... 20346.html
http://git.berlios.de/cgi-bin/gitweb.cg ... 3a5db90d82

The Debian maintainer Florian Weimer have started an ongoing discussion, Status of non-Hotspot VMs and Shark, on the distro-pkg-dev mailinglist to select which JVM to ship with the next Debian stable release.
http://markmail.org/message/tumzgkop6kqpklsw

Re: Java on Raspbian

Posted: Tue Sep 25, 2012 11:32 am
by plugwash
We should have an openjdk 7 based jamvm in raspbian soon. I just tested a build based on the package from debian experimental and it seems to come out clean and run test programs ok. Thanks to all of you who made this happen.

Unfortunately I screwed up the versioning when forward porting raspbian changes. So I need to do another overnight rebuild before it can hit the repo.

Re: Java on Raspbian

Posted: Wed Sep 26, 2012 8:29 am
by plugwash
Ok icedtea-7-jre-jamvm is now in the repo

Thanks to everyone who helped make this happen

Re: Java on Raspbian

Posted: Wed Sep 26, 2012 10:13 am
by Keelhaul
Can anyone tell how OpenJDK7 on Raspbian performs compared to Oracle JDK7 on Armel nowdays?

Re: Java on Raspbian

Posted: Wed Sep 26, 2012 10:41 am
by xranby
Keelhaul wrote:Can anyone tell how OpenJDK7 on Raspbian performs compared to Oracle JDK7 on Armel nowdays?
When i test real time applications like a Java2D game then i get
28fps using JamVM + OpenJDK7 + Rasbian
compared to
23fps using Oracle JDK7 7u6 + Debian armel

Which kind of application do you have in mind?

Re: Java on Raspbian

Posted: Wed Sep 26, 2012 10:46 am
by plugwash
AIUI openjdk using the default "zero" vm is SLOW. openjdk using jamvm is fast but there are a few java features it doesn't support.

Re: Java on Raspbian

Posted: Wed Sep 26, 2012 10:48 am
by Keelhaul
Ok thanks. Could you tell me what features aren't supported?

Re: Java on Raspbian

Posted: Wed Sep 26, 2012 11:40 am
by plugwash
I'm not a java expert myself I was just going by what I read earlier in this thread, specifically jan77's comment earlier in this thread.

Re: Java on Raspbian

Posted: Wed Sep 26, 2012 12:02 pm
by Keelhaul
xranby wrote: When i test real time applications like a Java2D game then i get
28fps using JamVM + OpenJDK7 + Rasbian
compared to
23fps using Oracle JDK7 7u6 + Debian armel

Which kind of application do you have in mind?
My application is heavy on capturing images (using JMF, which I'm not even sure will work on an ARM architecture as there don't seem to be any native libs) and audio and sending them via UDP.

Re: Java on Raspbian

Posted: Wed Sep 26, 2012 12:13 pm
by xranby
Keelhaul wrote:
xranby wrote: When i test real time applications like a Java2D game then i get
28fps using JamVM + OpenJDK7 + Rasbian
compared to
23fps using Oracle JDK7 7u6 + Debian armel

Which kind of application do you have in mind?
My application is heavy on capturing images (using JMF, which I'm not even sure will work on an ARM architecture as there don't seem to be any native libs) and audio and sending them via UDP.
http://fmj-sf.net/
FMJ is an open-source project with the goal of providing an alternative to Java Media Framework (JMF), while remaining API-compatible with JMF. It aims to produce a single API/Framework which can be used to capture, playback, process, and stream media across multiple platforms.

https://jogamp.org/
You may also use JogAmp that can do hardware accelerated video playback, YUV to RGB color conversion using fragment shaders, on the Pi.