nealk2k3
Posts: 17
Joined: Thu May 17, 2012 8:01 pm

Segmentation fault with Java 3D

Sat Dec 21, 2013 12:14 am

I have a project written in Java using Java 3D that I'm trying to get running on my Pi - one of the older model B boards with 256MB of RAM. I currently have 32MB allocated to the GPU and the rest to the OS.

I've downloaded the latest version of Raspbian that has Oracle Java 1.7.0_40-b43 pre installed and I have installed Java 3D 1.5.1 and its associated native libraries for ARM as well as maven, which I used to compile my code on the Pi.

I have run a simple 'Hello World' program to verify that Java itself runs properly and it seems fine, but when I try to run my program (which I have had running successfully on my PC where I developed it) it throws a segmentation fault on start up.

I have very limited experience with segmentation faults and don't really know where to start with debugging one. Could the problem simply be that the Pi just doesn't have enough memory for what I want to do? I've tried running the program with -Xmx set to 64, 128 and 512 but the same thing happens every time.
My program is not overly demanding on the Java 3D environment; the configuration I've tried uses only 9 spheres and one cube with a couple of lights.

If anyone has any suggestions I'd like to hear them.
Let me know if there's any more information I could supply that might be helpful.

Thanks for reading!

nealk2k3
Posts: 17
Joined: Thu May 17, 2012 8:01 pm

Re: Segmentation fault with Java 3D

Sat Dec 21, 2013 12:40 pm

I have now tried compiling a very simple program, from this page: http://www.java3d.org/starting.html
It's about as basic as you can get with Java 3D and it still gives me a segmentation fault.
I also tried pulling different versions of the native ARM library; I've taken them from debian dfsg-8 and dfsg-9 as well as ubuntu 13 and it's always the same problem.

If anyone has ever successfully run anything with Java 3D I'd be really interested to hear from you!

Thanks

User avatar
DougieLawson
Posts: 37732
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Segmentation fault with Java 3D

Sat Dec 21, 2013 12:51 pm

Is your Java runtime built for the ARMv6 processor?

It's normally installed using apt-get rather than downloading stuff from Oracle's website.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

nealk2k3
Posts: 17
Joined: Thu May 17, 2012 8:01 pm

Re: Segmentation fault with Java 3D

Sat Dec 21, 2013 2:39 pm

I'm using a Java runtime that now ships with the Raspbian operating system.
I saw this post:
http://www.raspberrypi.org/archives/4920
which suggests that oracle now make a proper ARM compatible JDK.
I haven't tried a JDK from another vendor though, so I might give that a try next.

nealk2k3
Posts: 17
Joined: Thu May 17, 2012 8:01 pm

Re: Segmentation fault with Java 3D

Sat Dec 21, 2013 3:41 pm

I've just tried with open JDK 7 (1.7.0_25, 'Iced Tea' 2.3.10)
I get a slightly different error; 'fatal error: caught unhandled signal 4'
It's effectively the same; it crashes saying there was an error in native code
This happens with each of the three native code libraries I've mentioned above.

nealk2k3
Posts: 17
Joined: Thu May 17, 2012 8:01 pm

Re: Segmentation fault with Java 3D

Sun Dec 22, 2013 1:17 pm

Some more detailed output from running with the Oracle JVM...
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) Client VM (build 24.0-b56, mixed mode)
Running Cube
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGILL (0x4) at pc=0xa6e5b9e2, pid=7251, tid=3057575024
#
# JRE version: Java(TM) SE Runtime Environment (7.0_40-b43) (build 1.7.0_40-b43)
# Java VM: Java HotSpot(TM) Client VM (24.0-b56 mixed mode linux-arm )
# Problematic frame:
# C [libj3dcore-ogl.so+0x69e2] Java_javax_media_j3d_NativePipeline_getAWT+0x11

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Segmentation fault with Java 3D

Sun Dec 22, 2013 3:34 pm

Perhaps you need more GPU memory ?


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

nealk2k3
Posts: 17
Joined: Thu May 17, 2012 8:01 pm

Re: Segmentation fault with Java 3D

Sun Dec 22, 2013 5:16 pm

I tried giving the GPU 128MB - much more than that and there wasn't enough left to run the OS - but it still gave me the same error

nealk2k3
Posts: 17
Joined: Thu May 17, 2012 8:01 pm

Re: Segmentation fault with Java 3D

Sun Dec 22, 2013 5:49 pm

From stack overflow I have learned that the version of the native code I'm using is wrong - debian armhf requires armv7 or higher, and the Pi is armv6. There is a suitable package available in the Raspbian package repo though so I have that.

Next battle - it wants GLX version 1.3

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Segmentation fault with Java 3D

Mon Dec 30, 2013 10:42 am

Are you sure that Oracle Java3D supports the Pi ? AFAIK only
Oracle JavaFX has been made to work with the Raspberry Pis
hardware-acceleration (which is quite vital IMHO).

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

User avatar
clicky
Posts: 425
Joined: Thu Oct 25, 2012 7:34 am

Re: Segmentation fault with Java 3D

Tue Dec 31, 2013 1:47 pm

Maybe ever so slightly off topic, but I've got libgdx working quite nicely on RPi after following:

http://www.habitualcoder.com/?page_id=257

I'll write it up in next few days - it boils down to a few easy things: get patched libgdx libs, get RemoteVM, setup libgdx projects in Eclipse and that's it. All the stuff that works locally on a PC/laptop (Windows/Linux/OSX) works well on RPi as well (and Android, iOS and Javascript on web page on HTML5/WebGL)...

Maybe it is worth trying to refactor your code to this library and have all above available as target platforms.

Return to “Java”