status of java on raspbian.


13 posts
by plugwash » Tue Jan 01, 2013 1:36 am
There are now quite a few java options for raspbian so I thought i'd sumarise them to help the confused newcomers decided what the best vm is for them.

zero
pros: full-featured, FOSS
cons: SLOW
notes: default vm in raspbian openjdk packages.
package name for openjdk-7: openjdk-7-jre
package name for openjdk-6: openjdk-6-jre

jamvm
pros: faster than zero, free, seems mature, FOSS
cons: slower in my (probablly highly flawed) test than avian and oracle. Lacks support for agents
package name for openjdk-7: icedtea-7-jre-jamvm
package name for openjdk-6: icedtea-7-jre-jamvm

avian
pros: seems faster than jamvm in my (probablly highly flawed) test, FOSS.
cons: seems very new, not available for openjdk-6, doesn't seem to be as fast as oracle vm in my (probablly highly flawed) test, not sure what if any limitations it has.
package name for openjdk-7: jvm-7-avian-jre

JDK 8 (with JavaFX) for ARM Early Access
pros: seems to be the fastest option, supplied class libraries include accelerated javafx implementation.
cons: propietary, doesn't appear to be redistributable, still prerelease, supplied class libraries are jdk8 based and don't include AWT/swing (though apparently the oracle embedded vm can be used with the class libraries from raspbian openjdk to get AWT/swing support).
forum thread: viewtopic.php?f=81&t=26110

The default vm for openjdk-7 on raspbian can be changed by editing /etc/java-7-openjdk/jvm-armhf.cfg. Presumablly a similar config file exists for openjdk-6 but I haven't checked myself.

edit: incorporated some of hendrik's fixes
edit2: add package name for avian, pointed out as missing by xranby
Moderator
Posts: 1439
Joined: Wed Dec 28, 2011 11:45 pm
by henrik » Tue Jan 01, 2013 6:24 am
oracle embedded JRE preview
pros: seems to be the fastest option, supplied class libraries include accelerated javafx implementation.
cons: propietary, doesn't appear to be redistributable, still prerelease, supplied class libraries are jdk8 based and don't include AWT/swing (though apparently the oracle embedded vm can be used with the class libraries from raspbian openjdk to get AWT/swing support).
forum thread: viewtopic.php?f=81&t=26110


That should be "Oracle JDK 8 preview for Linux/ARM". Our Java SE Embedded products (that you call the embedded JRE) is a commercial variant optimized for low memory footprint.

A few clarifications:
- All implementations use the OpenJDK class libraries, but with different VMs
- OpenJDK is developed by Oracle and other members of the OpenJDK community
- The Oracle JDK is based on OpenJDK, adding a few features that we either don't have the right to open source or that we keep closed for commercial reasons. For now that includes our ARM port of Hotspot, which is highly optimized.
- Oracle JDK binaries undergo extensive testing and are likely the highest quality.
- Oracle JDK is free (as in beer) for most purposes including redistribution with applications, see the license agreement you click through to download JDK 7
- The Oracle JDK 8 preview is under an early access license with more reatrictions
- Using the Swing/AWT libraries from OpenJDK 7 or Oracle JDK 7 with the JDK 8 preview is unlikely to work moving forward, but you can always compile OpenJDK 8 (our binaries and the OpenJDK source are kept in sync)
- JavaFX is partially available open source in the OpenJFX project on java.net, and will be fully open sourced over the next few months (including the ARM port)

Henrik Ståhl
Sr. Director, Product Managament
Java Platform Group, Oracle
Posts: 30
Joined: Tue Dec 18, 2012 4:24 pm
by xranby » Wed Feb 06, 2013 12:40 pm
The new hardfloat fixed CACAO JVM found in the new IcedTea 6 1.12 release work well under Raspbian. We should focus on packaging it.
http://blog.fuseyism.com/index.php/2013 ... -released/

While i know that compilation can be tricky i have prepared a RaspberryPi armhf CACAO libjvm.so that you can use as an drop in replacement into any OpenJDK 6 installation (/usr/lib/jvm/java-6-openjdk-armhf/jre/lib/arm/server/libjvm.so) This libjvm.so was built using the icedtea6 1.12 release from inside a Raspbian chroot.

The cacao armhf libjvm.so is found here:
http://labb.zafena.se/cacao/armhf-armv6/libjvm.so
if you want to use it in combination with a icedtea 6 openjdk 6 install run:
Code: Select all
sudo apt-get update
sudo apt-get install openjdk-6-jre
wget http://labb.zafena.se/cacao/armhf-armv6/libjvm.so
sudo cp libjvm.so /usr/lib/jvm/java-6-openjdk-armhf/jre/lib/arm/server/libjvm.so
sudo cp libjvm.so /usr/lib/jvm/java-6-openjdk-armhf/jre/lib/arm/cacao/libjvm.so
java -version
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby
User avatar
Posts: 292
Joined: Sat Mar 03, 2012 10:02 pm
by plugwash » Wed Feb 06, 2013 1:57 pm
xranby wrote:The new hardfloat fixed CACAO JVM found in the new IcedTea 6 1.12 release work well under Raspbian. We should focus on packaging it.

Looks like debian already did http://packages.qa.debian.org/o/openjdk ... 4840Z.html

I'll take a closer look when I get some time.

Does this version also contain the fixed jamvm?
Moderator
Posts: 1439
Joined: Wed Dec 28, 2011 11:45 pm
by xranby » Wed Feb 06, 2013 2:19 pm
plugwash wrote:
xranby wrote:The new hardfloat fixed CACAO JVM found in the new IcedTea 6 1.12 release work well under Raspbian. We should focus on packaging it.

Looks like debian already did http://packages.qa.debian.org/o/openjdk ... 4840Z.html

I'll take a closer look when I get some time.

Does this version also contain the fixed jamvm?


Yes both the armhf JamVM and the armhf CACAO are included in this new major 6 release.
Its mentioned in the release log: http://blog.fuseyism.com/index.php/2013 ... -released/
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby
User avatar
Posts: 292
Joined: Sat Mar 03, 2012 10:02 pm
by plugwash » Wed Feb 06, 2013 6:30 pm
I have split the posts about removing java and java security into their own thread. Please direct all discussion of that issue there not here.
Moderator
Posts: 1439
Joined: Wed Dec 28, 2011 11:45 pm
by plugwash » Wed Feb 06, 2013 8:30 pm
xranby wrote:Yes both the armhf JamVM and the armhf CACAO are included in this new major 6 release.
Its mentioned in the release log: http://blog.fuseyism.com/index.php/2013 ... -released/


Unfortunately it seems the new version failed to build on both armel and armhf in debian with different failures. Any thoughts? (i'm trying a build on raspbian anyway but I wouldn't be surprised if it fails too

armel:
libtool: compile: arm-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../../.. -I../../../../src -I../../../.. -I../../../../src -I/build/buildd-openjdk-6_6b27-1.12-1-armel-d7BDV2/openjdk-6-6b27-1.12/build/openjdk/jdk/src/solaris/javavm/export -I/build/buildd-openjdk-6_6b27-1.12-1-armel-d7BDV2/openjdk-6-6b27-1.12/build/openjdk/jdk/src/share/javavm/export -I/build/buildd-openjdk-6_6b27-1.12-1-armel-d7BDV2/openjdk-6-6b27-1.12/build/openjdk/jdk/src/solaris/javavm/export -I/build/buildd-openjdk-6_6b27-1.12-1-armel-d7BDV2/openjdk-6-6b27-1.12/build/openjdk/jdk/src/solaris/hpi/export -I/build/buildd-openjdk-6_6b27-1.12-1-armel-d7BDV2/openjdk-6-6b27-1.12/build/openjdk/jdk/src/share/hpi/export -I../../../../src -I../../../.. -I../../../../src -g -O2 -fno-strict-aliasing -D__ARM__ -D__LINUX__ -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -std=c99 -pedantic -Wall -Wno-long-long -MT asmpart.lo -MD -MP -MF .deps/asmpart.Tpo -c asmpart.S -fPIC -DPIC -o .libs/asmpart.o
asmpart.S: Assembler messages:
asmpart.S:242: Error: selected processor does not support ARM mode `blx exceptions_asm_new_abstractmethoderror'
make[7]: *** [asmpart.lo] Error 1

armhf:
make[1]: Entering directory `/build/buildd-openjdk-6_6b27-1.12-1-armhf-y7c3I9/openjdk-6-6b27-1.12/build'
if [ -e /build/buildd-openjdk-6_6b27-1.12-1-armhf-y7c3I9/openjdk-6-6b27-1.12/build/openjdk.build-ecj/j2sdk-image/bin/java ] ; then \
/build/buildd-openjdk-6_6b27-1.12-1-armhf-y7c3I9/openjdk-6-6b27-1.12/build/openjdk.build-ecj/j2sdk-image/bin/java -Xshare:dump ; \
fi
Loading classes to share ... #
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (os_linux_zero.cpp:270), pid=2433, tid=1090061424
# fatal error: caught unhandled signal 11
#
# JRE version: 6.0_27-b27
# Java VM: OpenJDK Zero VM (20.0-b12 interpreted mode linux-arm )
# Derivative: IcedTea6 1.12.0
# Distribution: Debian GNU/Linux unstable (sid), package 6b27-1.12-1
# An error report file with more information is saved as:
# /build/buildd-openjdk-6_6b27-1.12-1-armhf-y7c3I9/openjdk-6-6b27-1.12/build/hs_err_pid2433.log
#
# If you would like to submit a bug report, please include
# instructions how to reproduce the bug and visit:
# http://icedtea.classpath.org/bugzilla
#
/bin/bash: line 2: 2433 Aborted /build/buildd-openjdk-6_6b27-1.12-1-armhf-y7c3I9/openjdk-6-6b27-1.12/build/openjdk.build-ecj/j2sdk-image/bin/java -Xshare:dump
make[1]: *** [stamps/add-archive-ecj.stamp] Error 134
Moderator
Posts: 1439
Joined: Wed Dec 28, 2011 11:45 pm
by xranby » Wed Feb 06, 2013 8:56 pm
plugwash wrote:
xranby wrote:Yes both the armhf JamVM and the armhf CACAO are included in this new major 6 release.
Its mentioned in the release log: http://blog.fuseyism.com/index.php/2013 ... -released/


Unfortunately it seems the new version failed to build on both armel and armhf in debian with different failures. Any thoughts? (i'm trying a build on raspbian anyway but I wouldn't be surprised if it fails too

armel:
...
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (os_linux_zero.cpp:270), pid=2433, tid=1090061424
# fatal error: caught unhandled signal 11
#
# JRE version: 6.0_27-b27
# Java VM: OpenJDK Zero VM (20.0-b12 interpreted mode linux-arm )
...


Was this reported from the official armel Debian builders?
having access to the /build/buildd-openjdk-6_6b27-1.12-1-armhf-y7c3I9/openjdk-6-6b27-1.12/build/hs_err_pid2433.log do help if possible.

So this looks like an internal crash inside the ARM32 assembler interpreter port that is an extension on top of zero for ARM OR the generic OpenJDK zero vm (they both use unfortunately the same version number string when run on hardware without Thumb2). These bugs are hard to track down, usually happens inside the 10K line handwritten ARM assembler interpreter addon for Zero.

If the bug is persistent then A) try switch the default JVM powering OpenJDK6 used by the buildd to JamVM.
(edit /etc/java-6-openjdk/jvm-armhf.cfg on the builder and make sure
-jamvm KNOWN
is on the top)

or B) disable zero for the build edit the debian rules for armel and armhf and make jamvm the default jvm. it might be a problem with Zero for the 6 1.12 release because Oracle do not test Zero at all, for what I know, in OpenJDK upstream and the IcedTea release team only got limited testing of zero on different platforms. So the safest bet is to disable Zero.

All in all I will try reproduce and if I can reproduce it then file a bugreport with the IcedTea team.
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby
User avatar
Posts: 292
Joined: Sat Mar 03, 2012 10:02 pm
by plugwash » Thu Feb 07, 2013 4:08 am
The "# A fatal error has been detected by the Java Runtime Environment:" was from debian armhf, build log at https://buildd.debian.org/status/fetch. ... 1359686380

I've just confirmed that raspbian fails in the same way as debian armhf. The error log file is at http://plugwash.raspbian.org/hs_err_pid ... spbian.log

I'll be fililng a bug report with debian once i've reproduced the bug on it and got the errror log file.
Moderator
Posts: 1439
Joined: Wed Dec 28, 2011 11:45 pm
by plugwash » Thu Feb 07, 2013 4:34 am
Looks like 1.12.1 just hit sid, waiting to see if that fails too.
Moderator
Posts: 1439
Joined: Wed Dec 28, 2011 11:45 pm
by xranby » Thu Feb 07, 2013 12:31 pm
plugwash wrote:Looks like 1.12.1 just hit sid, waiting to see if that fails too.

looks promising:
https://buildd.debian.org/status/packag ... =openjdk-6 Debian armhf build sucess using IcedTea6 1.12.1

armel still fail to build because Debian soft-float armel target armv4t while the CACAO assembler part of the code used a BLX armv5+ instruction. This is easily fixed the key is to replace the
BLX ...
with a
mov PC, LR
BX ...
instruction pair, BLX is only a compact assembler instruction found in armv5 and later to do a backup of the PC register into the LR and branch using the same instruction. This needs to be fixed with cacao upstream. And nothing for Raspbian to worry about since we target armv6 that include BLX!
Code: Select all
make[7]: Entering directory `/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/cacao/cacao-68fe50ac34ec/src/vm/jit/arm'
/bin/bash ../../../../libtool   --mode=compile arm-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../../..  -I../../../../src -I../../../.. -I../../../../src -I/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/openjdk/jdk/src/solaris/javavm/export -I/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/openjdk/jdk/src/share/javavm/export -I/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/openjdk/jdk/src/solaris/javavm/export -I/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/openjdk/jdk/src/solaris/hpi/export -I/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/openjdk/jdk/src/share/hpi/export -I../../../../src -I../../../.. -I../../../../src -g -O2 -fno-strict-aliasing -D__ARM__ -D__LINUX__ -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -std=c99 -pedantic -Wall -Wno-long-long  -MT asmpart.lo -MD -MP -MF .deps/asmpart.Tpo -c -o asmpart.lo asmpart.S
/bin/bash ../../../../libtool --tag=CC   --mode=compile arm-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../../..  -I../../../../src -I../../../.. -I../../../../src -I/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/openjdk/jdk/src/solaris/javavm/export -I/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/openjdk/jdk/src/share/javavm/export -I/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/openjdk/jdk/src/solaris/javavm/export -I/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/openjdk/jdk/src/solaris/hpi/export -I/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/openjdk/jdk/src/share/hpi/export -std=c99 -pedantic -Wall -Wno-long-long  -D__ARM__ -D__LINUX__ -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_REENTRANT -g -O2 -fno-strict-aliasing -MT emit.lo -MD -MP -MF .deps/emit.Tpo -c -o emit.lo emit.c
libtool: compile:  arm-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../../.. -I../../../../src -I../../../.. -I../../../../src -I/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/openjdk/jdk/src/solaris/javavm/export -I/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/openjdk/jdk/src/share/javavm/export -I/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/openjdk/jdk/src/solaris/javavm/export -I/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/openjdk/jdk/src/solaris/hpi/export -I/build/buildd-openjdk-6_6b27-1.12.1-1-armel-MmogaA/openjdk-6-6b27-1.12.1/build/openjdk/jdk/src/share/hpi/export -I../../../../src -I../../../.. -I../../../../src -g -O2 -fno-strict-aliasing -D__ARM__ -D__LINUX__ -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -std=c99 -pedantic -Wall -Wno-long-long -MT asmpart.lo -MD -MP -MF .deps/asmpart.Tpo -c asmpart.S  -fPIC -DPIC -o .libs/asmpart.o
asmpart.S: Assembler messages:
asmpart.S:242: Error: selected processor does not support ARM mode `blx exceptions_asm_new_abstractmethoderror'
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby
User avatar
Posts: 292
Joined: Sat Mar 03, 2012 10:02 pm
by plugwash » Thu Feb 07, 2013 10:41 pm
xranby wrote:This needs to be fixed with cacao upstream. And nothing for Raspbian to worry about

While it's not directly relavent to raspbian having the package stay in good shape on debian armel is probablly a good thing for us.

I may try and whip up a patch, is there a preferred way of selecting arm version specific code within the cacao codebase?

Getting back onto the subject of raspbian i've just built the new openjdk-6 successfully for raspbian. I will then run some basic tests.

Do you have any information on pros/cons of cacao vs zero, jamvm and avian?

Note: since this discussion is getting a bit long I may split it off into it's own thread later, please don't take offense if I do.
Moderator
Posts: 1439
Joined: Wed Dec 28, 2011 11:45 pm
by plugwash » Fri Feb 08, 2013 12:11 pm
Ok the new version of openjdk-6 including a working cacao is now in raspbian.
Moderator
Posts: 1439
Joined: Wed Dec 28, 2011 11:45 pm