user285594
user285594

Reputation:

How to solve this JNA issue?

I have application which use JNA and gets the audio and video. It works in my Linux box. But when i am testing it in Windows. It just never working. Because i am still learning, i will appreciate your suggestion how to fix it, i already spent few days and weeks only to work it out, but just dont get this why JAVA does not work simply, its a cross platform. Why should it require again System path or etc configuration.

I am totally lost now, why it works in Linux and it does not work in Windows XP ? How can i run it then ?

Inside the lib direcotry i have my JNA and Audio libraries.
C:\Documents and Settings\test\Desktop\test>dir
 Volume in drive C has no label.
 Volume Serial Number is 680F-0963

 Directory of C:\Documents and Settings\test\Desktop\test

19/12/2010  22:09    <DIR>          .
19/12/2010  22:09    <DIR>          ..
19/12/2010  22:09            51.791 Audio.jar
19/12/2010  22:09    <DIR>          lib
               1 File(s)         51.791 bytes
               3 Dir(s)     487.002.112 bytes free



Now trying to run Audio.jar, gets Fail 1:

C:\Documents and Settings\test\Desktop\test>java -Djava.library.path=~/jni -jar
Audio.jar
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load librar
y gstreamer-0.10
        at org.gstreamer.lowlevel.GNative.loadWin32Library(GNative.java:83)
        at org.gstreamer.lowlevel.GNative.loadLibrary(GNative.java:43)
        at org.gstreamer.lowlevel.GstNative.load(GstNative.java:42)
        at org.gstreamer.lowlevel.GstNative.load(GstNative.java:39)
        at org.gstreamer.Gst.<clinit>(Gst.java:59)
        at video.MyVideo.simpletest(MyVideo.java:31)
        at sipphone.MainApplet.run(MainApplet.java:58)
        at sipphone.MainApplet.main(MainApplet.java:43)


Fail 2:
C:\Documents and Settings\test\Desktop\test>java -Djna.library.path=. -jar Audio
.jar
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load librar
y gstreamer-0.10
        at org.gstreamer.lowlevel.GNative.loadWin32Library(GNative.java:83)
        at org.gstreamer.lowlevel.GNative.loadLibrary(GNative.java:43)
        at org.gstreamer.lowlevel.GstNative.load(GstNative.java:42)
        at org.gstreamer.lowlevel.GstNative.load(GstNative.java:39)
        at org.gstreamer.Gst.<clinit>(Gst.java:59)
        at video.MyVideo.simpletest(MyVideo.java:31)
        at sipphone.MainApplet.run(MainApplet.java:58)
        at sipphone.MainApplet.main(MainApplet.java:43)

Upvotes: 0

Views: 3408

Answers (3)

Anthony
Anthony

Reputation: 11

trying to run mediarenderer from cling package, I had the same error on windows xp. i got the right libgstreamer-0.10.so from package GStreamer-WinBuilds-GPL-x86-Beta04-0.10.7.msi found in https://code.google.com/archive/p/ossbuild/downloads

once installed (environment variables PATH (for dependencies) and OSSBUILD_GSTREAMER_DIR set), in a prompt, I was finally able to run mediarenderer using the following syntax to introduce lib's path :

Z:\Downloads\cling-distribution-2.1.0\cling-distribution-2.1.0\mediarenderer\target>java -Djna.library.path="C:\Program Files\OSSBuild\GStreamer\v0.10.7\bin" -jar cling-mediarenderer-2.1.0-standalone.jar

hope this helps as a starting point !

Upvotes: 1

MBCook
MBCook

Reputation: 14504

You'll need to have the DLL installed, or at least in your JNA library path as others have pointed out.

It does add an extra dependency on Windows. It would be an extra dependency on Linux but gstreamer is preinstalled by your distribution. I ran into this same problem when I was making something to use a USB port from Java.

The only solution I know of to avoid the DLL would be to have a second version of the code you could call on Windows that would only use Win32 stuff (i.e. stuff that ships with Windows) but that would be a very large undertaking.

Upvotes: 1

leedm777
leedm777

Reputation: 24032

For Fail 1: I don't believe that the ~/ syntax will work on Windows. Try %HOME%\ instead. The tilde expansion happens in Bash, so things are a bit different in Windows.

For Fail 2: It doesn't look like the .dll is in your test directory, and you're setting the jna.library.path to ..

If the .dll's are in your lib directory, then shouldn't the paths be set to that directory, instead of ~/jni and .?

Upvotes: -1

Related Questions