Embedded Java SE with Ubuntu 12.04 on Pandaboard (Installation instructions and unsolved problems)

2,292 views
Skip to first unread message

magog96

unread,
May 3, 2012, 7:43:11 PM5/3/12
to pandaboard
Hi,
as I wrote in another reply to this list I want to share some details
about the Embedded Java SE from Oracle.
So far I couldn't get the latest release working with Ubuntu 12.04
Server on my Pandaboard but the installation instructions might still
be useful for some of you. I was also to fix an initial problem with a
missing lib (and the worthless error message "java: no such file or
directory" instead of a more useful message like "Can't find /lib/ld-
linux.so.3") but after that I was stuck.

Let's start...

Here you find some motivation why it might be a good idea to use the
Oracle Embedded Java SE instead of some other (except for maybe
Cacao):
https://blogs.oracle.com/jtc/entry/part_deux_comparing_jvms_on

Embedded Java SE can be downloaded from the Oracle website:
http://www.oracle.com/technetwork/java/embedded/downloads/javase/index.html

Here the installation instructions. The problems are described at the
end.
1.) Download the Java SE Embedded version for your PandaBoard(-ES) or
Beagleboard(-xM). That would be the ARMv6/7 Linux - Headless (optional
for Java SE 7 the 'Server Compiler') or ARMv7 Linux - Headful.
2.) Copy the ejre*.tar.gz onto a USB drive or copy it directly to your
SD-Card if you haven't downloaded the file directly onto the system.

3.) The following is based upon command line commands, so open one up
and go to the location where the ejre*.tar.gz file can be found.
You should replace 'ejre*.tar.gz' with the full name at the following
lines and later 'ejre1.7.0_04' with the actual directory name.
4.) To make it accessable run:
sudo chmod u+x ejre*.tar.gz
5.) To extract run:
tar -xvf ejre*.tar.gz
6.) There should now be a directory ejre<java-version>_<update-number>
(currently 'ejre1.7.0_04' for Embedded Java SE 7 Update 4 and
'ejre1.6.0_30' for Embedded Java SE 6 Update 30). There is no
difference between headless and headful, but you could rename the
directory if you like. In the following steps I assume that you used
the original directory names.
7.) Now change the owner to root be running:
sudo chown -R root:root ./ejre1.7.0_04
8.) Next we have to place the files somewhere where they actually
belong (under '/usr/lib/jvm/')
As the directory might not yet exist we run:
sudo mkdir -p /usr/lib/jvm
9.) Now we move the extracted directory with the Java Runtime by
running:
sudo mv ejre1.7.0_04 /usr/lib/jvm
10.) To be able to run Java as a user there is the 'update-
alternatives' option or by creating the file javart.sh in /etc/
profile.d/.
For now I choose the second option for now which should allow to run
java as a user but not root.
To do that run:
echo 'export JAVA_HOME=/usr/lib/jvm/ejre1.7.0_04' | sudo tee /etc/
profile.d/javart.sh
echo 'export PATH=$PATH:$JAVA_HOME/bin' | sudo tee -a /etc/profile.d/
javart.sh
11.) You might want to check if the correct content has been written
into /etc/profile.d/javart.sh and correct the content if needed
sudo nano /etc/profile.d/javart.sh
or if you installed 'mc' like I have
sudo mcedit /etc/profile.d/javart.sh
12.) Now we should reboot by running:
sudo reboot

13.) After the reboot login and run:
printenv
14.) Check if the following lines show up:
PATH=[..a lot of /bin /usr/bin and so on..] <-- here you should
find '/usr/lib/jvm/ejre1.7.0_04/bin' at the end
JAVA_HOME=/usr/lib/jvm/ejre1.7.0_04

15.) If the above is correct you should be able to run 'java -version'
but on Ubuntu 12.04 for ARM this will fail (at least here) with a '-
bash: java: no such file or directory'
Below what I found out so far.


Looking for the problem that the Embedded Java SE (ejre) from Oracle
doesn't work. If you take a closer look at the Oracle website you see
that Oracle tells you what libs and kernel you need (see
http://www.oracle.com/technetwork/java/embedded/resources/se-embeddocs/index.html#sysreqs).
The Linux Kernel is 2.6.28 or higher and Ubuntu 12.04 comes with a
Linux Kernel 3.2.0 so this might be involved here. Another requirement
is glibc 2.9 or higher.
After digging a little bit and playing with 'ldd java', 'file java' as
well as 'readelf -l java' and 'readelf -a java'. The readelf
application will list the required libs for the java executable.
==========================
me@pandaboard:/usr/lib/jvm/ejre1.7.0_04/bin$ readelf -a java

Elf file type is EXEC (Executable file)
Entry point 0x8404
There are 8 program headers, starting at offset 52

Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg
Align
EXIDX 0x0005d8 0x000085d8 0x000085d8 0x00050 0x00050 R
0x4
PHDR 0x000034 0x00008034 0x00008034 0x00100 0x00100 R E
0x4
INTERP 0x000134 0x00008134 0x00008134 0x00013 0x00013 R
0x1
[Requesting program interpreter: /lib/ld-linux.so.3]
[...]
Dynamic section at offset 0x640 contains 30 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library:
[libpthread.so.0]
0x00000001 (NEEDED) Shared library: [libjli.so]
0x00000001 (NEEDED) Shared library: [libdl.so.2]
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x00000001 (NEEDED) Shared library: [libgcc_s.so.
1]
0x0000000e (SONAME) Library soname: [lib.so]
0x0000000f (RPATH) Library rpath: [$ORIGIN/../
lib/arm/jli:$ORIGIN/../jre/lib/arm/jli]
[...]
==========================

The first thing I noticed was the hardcoded path '/lib/linux-ld.so.3'.
I checked the /lib directory and didn't see it. But there is a link
called 'ld-linux-armhf.so.3' pointing to 'arm-linux-gnueabihf/
ld-2.15.so' (subdirectory of /lib). As this is obviously the same I go
to the /lib directory and run:
sudo ln -s arm-linux-gnueabihf/ld-2.15.so ld-linux.so.3

Ok, this fixed the first issue above but it's quite a stupid idea to
use hardcoded path information in the executable as since last year
(or even before) the platform dependency has been lowered and this now
strikes back to haunt Oracle.
Now I fired with the 'strace' utility at the 'java' executable to see
how far I could get with the initial issue fixed with a simple link in
the file system.
First I ran 'strace -e open java -version' which showed that now at
least some files are loaded ('libpthread.so.0' could be found as well
as the 'libjli.so' which is shipped with the Oracle Embedded Java SE
Runtime).
Still is doesn't fully work.
Next I ran 'strace -e all java -version' to get more details:
===========================
me@pandaboard:/lib$ strace -e all java -version
[...]
open("/lib/arm-linux-gnueabihf/libpthread.so.0", O_RDONLY|O_CLOEXEC) =
3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\5P
\0\0004\0\0\0"..., 512) = 512
lseek(3, 66332, SEEK_SET) = 66332
read(3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
1400) = 1400
lseek(3, 65924, SEEK_SET) = 65924
read(3, "A6\0\0\0aeabi\0\1,\0\0\0\0057-A\0\6\n\7A\10\1\t\2\n\4\22"...,
55) = 55
fstat64(3, {st_mode=S_IFREG|0755, st_size=100802, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb6f0e000
mmap2(NULL, 107024, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3,
0) = 0xb6ed2000
mprotect(0xb6ee2000, 28672, PROT_NONE) = 0
mmap2(0xb6ee9000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|
MAP_DENYWRITE, 3, 0xf) = 0xb6ee9000
mmap2(0xb6eeb000, 4624, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|
MAP_ANONYMOUS, -1, 0) = 0xb6eeb000
close(3) = 0
open("/usr/lib/jvm/ejre1.7.0_04/bin/../lib/arm/jli/libjli.so",
O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF
\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\220\27\0\0004\0\0\0"..., 512)
= 512
lseek(3, 79512, SEEK_SET) = 79512
read(3,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
1120) = 1120
lseek(3, 78572, SEEK_SET) = 78572
read(3, "A2\0\0\0aeabi\0\1(\0\0\0\5ARM10TDMI\0\6\3\10\1\t"..., 51) =
51
exit_group(1) = ?

me@pandaboard:/lib$
===========================

At this point I'm stuck.
If there is someone who know knows more about the Linux debugging
tools or has an idea what might be the problem by just looking at the
last 6 lines of the strace output above please let me know.

Thanks.

Juergen

Robert Nelson

unread,
May 3, 2012, 7:55:49 PM5/3/12
to panda...@googlegroups.com
On Thu, May 3, 2012 at 6:43 PM, magog96 <mag...@googlemail.com> wrote:
> Hi,
> as I wrote in another reply to this list I want to share some details
> about the Embedded Java SE from Oracle.
> So far I couldn't get the latest release working with Ubuntu 12.04
> Server on my Pandaboard but the installation instructions might still
> be useful for some of you. I was also to fix an initial problem with a
> missing lib (and the worthless error message "java: no such file or
> directory" instead of a more useful message like "Can't find /lib/ld-
> linux.so.3") but after that I was stuck.

See: http://comments.gmane.org/gmane.linux.linaro.cross-distro/262

Bottom line, java is looking for the old "armel" /lib/ld-linux.so.3,
however your running armhf, so either install the armel mulitarch
binaries or get an armhf version of the java..

Regards,

--
Robert Nelson
http://www.rcn-ee.com/

magog96

unread,
May 3, 2012, 8:15:51 PM5/3/12
to pandaboard
Hi Robert!

On 4 Mai, 01:55, Robert Nelson <robertcnel...@gmail.com> wrote:
> On Thu, May 3, 2012 at 6:43 PM, magog96 <mago...@googlemail.com> wrote:
> > Hi,
> > as I wrote in another reply to this list I want to share some details
> > about the Embedded Java SE from Oracle.
> > So far I couldn't get the latest release working with Ubuntu 12.04
> > Server on my Pandaboard but the installation instructions might still
> > be useful for some of you. I was also to fix an initial problem with a
> > missing lib (and the worthless error message "java: no such file or
> > directory" instead of a more useful message like "Can't find /lib/ld-
> > linux.so.3") but after that I was stuck.
>
> See:http://comments.gmane.org/gmane.linux.linaro.cross-distro/262
>
> Bottom line, java is looking for the old "armel" /lib/ld-linux.so.3,
> however your running armhf, so either install the armel mulitarch
> binaries or get an armhf version of the java..

That's not the issue as far as I see it.
Oracle is already using "HardFloat" (--> EABI, Hard Float (VFP),
Little Endian) as you can see here:
http://www.oracle.com/technetwork/java/embedded/resources/se-embeddocs/index.html#sysreqs
or here
http://www.oracle.com/technetwork/java/embedded/downloads/javase/index.html

Still they use the incorrect path/filename for the lib.

As they already use the "HardFloat" my solution with the link should
solve the issue.
Because after adding the link the other libs are loaded this already
seems to work otherwise I would assume that the other libs wouldn't
load at all.

Still I'm going to lookup the information from the URL you provided.

Regards,
Juergen

jcon...@optonline.net

unread,
May 3, 2012, 10:50:40 PM5/3/12
to pandaboard
I suspect what is needed here is an armhf version of the Java SE-E
binaries, which unfortunately, are not available.

-- Jim C

On May 3, 8:15 pm, magog96 <mago...@googlemail.com> wrote:
> Hi Robert!
>
> On 4 Mai, 01:55, Robert Nelson <robertcnel...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > On Thu, May 3, 2012 at 6:43 PM, magog96 <mago...@googlemail.com> wrote:
> > > Hi,
> > > as I wrote in another reply to this list I want to share some details
> > > about the Embedded Java SE from Oracle.
> > > So far I couldn't get the latest release working with Ubuntu 12.04
> > > Server on my Pandaboard but the installation instructions might still
> > > be useful for some of you. I was also to fix an initial problem with a
> > > missing lib (and the worthless error message "java: no such file or
> > > directory" instead of a more useful message like "Can't find /lib/ld-
> > > linux.so.3") but after that I was stuck.
>
> > See:http://comments.gmane.org/gmane.linux.linaro.cross-distro/262
>
> > Bottom line, java is looking for the old "armel" /lib/ld-linux.so.3,
> > however your running armhf, so either install the armel mulitarch
> > binaries or get an armhf version of the java..
>
> That's not the issue as far as I see it.
> Oracle is already using "HardFloat" (--> EABI, Hard Float (VFP),
> Little Endian) as you can see here:http://www.oracle.com/technetwork/java/embedded/resources/se-embeddoc...
> or herehttp://www.oracle.com/technetwork/java/embedded/downloads/javase/inde...

jcon...@optonline.net

unread,
May 3, 2012, 10:53:03 PM5/3/12
to pandaboard
I suspect that an armhf version of the JavaSE-E binaries are required
which are, unfortunately, currently not available.

-- Jim C

On May 3, 8:15 pm, magog96 <mago...@googlemail.com> wrote:
> Hi Robert!
>
> On 4 Mai, 01:55, Robert Nelson <robertcnel...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > On Thu, May 3, 2012 at 6:43 PM, magog96 <mago...@googlemail.com> wrote:
> > > Hi,
> > > as I wrote in another reply to this list I want to share some details
> > > about the Embedded Java SE from Oracle.
> > > So far I couldn't get the latest release working with Ubuntu 12.04
> > > Server on my Pandaboard but the installation instructions might still
> > > be useful for some of you. I was also to fix an initial problem with a
> > > missing lib (and the worthless error message "java: no such file or
> > > directory" instead of a more useful message like "Can't find /lib/ld-
> > > linux.so.3") but after that I was stuck.
>
> > See:http://comments.gmane.org/gmane.linux.linaro.cross-distro/262
>
> > Bottom line, java is looking for the old "armel" /lib/ld-linux.so.3,
> > however your running armhf, so either install the armel mulitarch
> > binaries or get an armhf version of the java..
>
> That's not the issue as far as I see it.
> Oracle is already using "HardFloat" (--> EABI, Hard Float (VFP),
> Little Endian) as you can see here:http://www.oracle.com/technetwork/java/embedded/resources/se-embeddoc...
> or herehttp://www.oracle.com/technetwork/java/embedded/downloads/javase/inde...

Alison Chaiken

unread,
May 4, 2012, 9:32:33 PM5/4/12
to pandaboard
Is there any Jazelle-instruction Linux support for OMAP4? I suspect
not, as I can't find any information about it, or perhaps there's no
information without paying a license fee? Could it be that Jazelle
support is what the original poster is lacking rather than hard-float?

-- Alison

Tom Mitchell

unread,
May 4, 2012, 11:09:09 PM5/4/12
to panda...@googlegroups.com
Also consider the additional steps to get
Dalvik running. The Dalvik VM on ARM may
be better than a random JVM because Android
depends on it. I have yet to try it myself ;-)

http://en.wikipedia.org/wiki/Dalvik_(software)

There are some other tricks that "Android dalvik" applications
do for reasons of speed or for other reasons.... some are just
lazy.
--
  T o m   M i t c h e l l

magog96

unread,
May 7, 2012, 4:50:39 PM5/7/12
to pandaboard
Hi Alison
Oracle Embedded Java worked on previous Ubuntu ARM releases (e.g.
11.10), so that's no problem. I've did also use the Embedded Java 7u2
on my HP Touchpad with is a Linux Kernel running on an Qualcomm APQ
ARM based processor. I also have no idea if Oracle or Sun did pay the
Jazelle license fee previously so that their Embedded Java is allowed
to use the extra instructions of the ARM core (if still available in
current ARM Cortex A8, A9,.. cores).
The problem might still be Hard Float related as previously Linux
released were Soft Float but what I don't understand is why Oracle
says it uses Hard Float.
I try to get some information from Oracle (maybe some old Innotek
connections can help here).

Regards,
Juergen
Reply all
Reply to author
Forward
0 new messages