Unable to compile hello world program with gstreamer-java

977 views
Skip to first unread message

askin chokkatravo

unread,
Dec 21, 2015, 9:52:49 AM12/21/15
to gstreamer-java
Hi all,

I followed below steps in Ubuntu 14.04. I m from c/c++ background. Excuse me for basic knowledge in java build.

1) Build  gst1-java-core

https://github.com/gstreamer-java/gst1-java-core
  
#mvn compile
#mvn install

I got the .jar file in .m2/repository/org/freedesktop/gstreamer/gst1-java-core/0.9-SNAPSHOT/gst1-java-core-0.9-SNAPSHOT.jar

2) Downloaded jna.jar file from

   http://mvnrepository.com/artifact/net.java.dev.jna/jna             => Version 4.2.1

3) Link both the jar files in the eclipse java project.


4)  Wrote sample code like below:

package samplejavapject;
import org.freedesktop.gstreamer.Gst;


public class HelloWorld {

    public static void main(String[] args)
    {
        System.out.println("Welcome");
        Gst.init("testGstPgm", args);
    }
}


 4) Now when i compile, I received the below error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load library: gstreamer
    at org.freedesktop.gstreamer.lowlevel.GstNative.load(GstNative.java:53)
    at org.freedesktop.gstreamer.lowlevel.GstNative.load(GstNative.java:43)
    at org.freedesktop.gstreamer.Gst.<clinit>(Gst.java:77)
    at samplejavapject.HelloWorld.main(HelloWorld.java:10)




I understand that  my box is missing gstreamer library,  I have the following packages installed in my machine. Correct me if i am wrong?

gir1.2-gstreamer-0.10

gstreamer0.10-alsa:amd64
gstreamer0.10-nice:amd64
gstreamer0.10-plugins-bad:amd64
gstreamer0.10-plugins-base:amd64
gstreamer0.10-plugins-base-apps
gstreamer0.10-plugins-good:amd64
gstreamer0.10-plugins-ugly:amd64
gstreamer0.10-pulseaudio:amd64
gstreamer0.10-tools
gstreamer0.10-x:amd64
libgstreamer-plugins-bad0.10-0:amd64
libgstreamer-plugins-base0.10-0:amd64
libgstreamer-plugins-base0.10-dev
libgstreamer0.10-0:amd64
libgstreamer0.10-dev


gir1.2-gstreamer-1.0
gstreamer1.0-alsa:amd64
gstreamer1.0-clutter
gstreamer1.0-gnonlin
gstreamer1.0-libav:amd64
gstreamer1.0-nice:amd64
gstreamer1.0-plugins-bad:amd64
gstreamer1.0-plugins-bad-faad:amd64
gstreamer1.0-plugins-bad-videoparsers:amd64
gstreamer1.0-plugins-base:amd64
gstreamer1.0-plugins-base:i386
gstreamer1.0-plugins-base-apps
gstreamer1.0-plugins-good:amd64
gstreamer1.0-plugins-ugly:amd64
gstreamer1.0-pulseaudio:amd64
gstreamer1.0-tools
gstreamer1.0-vaapi:amd64
gstreamer1.0-x:amd64


libgstreamer-plugins-base1.0-0:amd64
libgstreamer-plugins-base1.0-0:i386
libgstreamer-plugins-base1.0-dev
libgstreamer-plugins-good1.0-0:amd64
libgstreamer-plugins-good1.0-dev
libgstreamer-vaapi1.0-0:amd64
libgstreamer-vaapi1.0-dev
libgstreamer1.0-0:amd64
libgstreamer1.0-0:i386
libgstreamer1.0-dev
libreoffice-avmedia-backend-gstreamer
phonon-backend-gstreamer:amd64
phonon-backend-gstreamer-common:amd64
phonon-backend-gstreamer1.0


Do i need to explicty load the libraries in the java file? or what am i missing. Kindly need your input.


 




Christophe Lafolet

unread,
Dec 21, 2015, 12:59:53 PM12/21/15
to gstreamer-java

hello

gst1-java-core use native gstreamer 1.0 libraries.


have you specified the path where the JVM shall find native gstreamer 1.0 libraries ?

christophe

Neil C Smith

unread,
Dec 21, 2015, 1:19:56 PM12/21/15
to gstream...@googlegroups.com
On 21 December 2015 at 16:44, Christophe Lafolet
<christoph...@gmail.com> wrote:
> have you specified the path where the JVM shall find native gstreamer 1.0
> libraries ?

That shouldn't be required on Ubuntu. I suspect this may be an issue
with loading JNA.

Does the program work if you add the line -

System.setProperty("jna.nosys", "true");

as the first line of main?

Or pass it on the launch line as -Djna.nosys=true

If that doesn't work, can you try stepping through the code in a
debugger, specifically here
https://github.com/gstreamer-java/gst1-java-core/blob/master/src/org/freedesktop/gstreamer/lowlevel/GstNative.java#L46
It's a mistake in my opinion that this code ignores the actual
exception that gets thrown.

Best wishes,

Neil

--
Neil C Smith
Artist : Technologist : Adviser
http://neilcsmith.net

Praxis LIVE - hybrid visual IDE for creative coding - www.praxislive.org
Digital Prisoners - interactive spaces and projections -
www.digitalprisoners.co.uk

askin chokkatravo

unread,
Dec 23, 2015, 1:17:10 AM12/23/15
to gstreamer-java
Hi Neil, Christopher

Thanks for the update. I could able to build gstreamer java  providing proper path of .so file.

I have added the below path in the run configuration of the project under 'Arguments'.

-Djava.library.path=/usr/lib/x86_64-linux-gnu


Thanks both of you for your support. Eager to see more with gstreamer java binding. :)

Neil C Smith

unread,
Dec 23, 2015, 4:37:17 AM12/23/15
to gstream...@googlegroups.com


On 23 Dec 2015 06:17, "askin chokkatravo" <get2...@gmail.com> wrote:
> -Djava.library.path=/usr/lib/x86_64-linux-gnu

I'm glad you got things working, but surprised if that is what actually fixed it!

Firstly, that path should be found automatically, and secondly, JNA uses jna.library.path

Best wishes,

Neil

Neil C Smith

unread,
Dec 23, 2015, 4:42:06 AM12/23/15
to gstream...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages