gstreamer-java / gst1-java-core

Java bindings for GStreamer 1.x
GNU Lesser General Public License v3.0
194 stars 72 forks source link

java.lang.NoSuchFieldError: SIZE with jdk11 #128

Closed Tux12Fun closed 5 years ago

Tux12Fun commented 5 years ago

Hi, I get the following exception on


Gst.init("AudioPlayer",args);

Exception in thread "main" java.lang.NoSuchFieldError: SIZE
    at org.freedesktop.gstreamer.Gst$NativeArgs.<init>(Gst.java:87)
    at org.freedesktop.gstreamer.Gst.init(Gst.java:292)
    at player.CLS_GST_Player.<init>(CLS_GST_Player.java:142)
    at player.gui.player_GUI.<init>(player_GUI.java:68)
    at player.player_main.main(player_main.java:119)

I'm not sure if this relates to the Fix in the 0.9.3 Version: -> FIX code inherited from 0.10 bindings that assumed NativeLong size and Native.SIZE_T_SIZE were the same - broke bindings on Java 9+ with Windows 10 x64.

But I have a Ubuntu Linux with Netbeans 9 and OpenJDK11 with Lib 0.9.2 and 0.9.3 reproducible. JNA Lib is 5.1.0 Gstreamer is /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.1404.0

dpkg output:
ii  libgstreamer-gl1.0-0:amd64               1.14.4-1ubuntu1           amd64                     GStreamer GL libraries
ii  openjdk-11-jdk:amd64                     11.0.1+13-2ubuntu1        amd64                     OpenJDK Development Kit (JDK)
Tux12Fun commented 5 years ago

I've done a bit of testing. JNA is the issue. JNA 5.0.0 (and up) brakes gst1-java-core. With the noticed error.

JNA 4.5.2 is the latest working JNA.

I'll hope this helps you to find the problem faster. Currently I use the workaround JNA 4.5.2

PS: Thank you for your great work with this Lib. I used the 0.10 version and had to migrate and it was so easy to do this. Thank you guys.

neilcsmith-net commented 5 years ago

Thanks for the report. JNA 5.x isn't supported yet. There is a commit in master that should fix that, but no release with it so far until it's been better tested.

alopumomovia commented 5 years ago

Using MAVEN (under the org.freedesktop.gstreamer group ID) automatically adds JNA 5.0.0

neilcsmith-net commented 5 years ago

@alopumomovia yes, this is a known issue. You should be able to explicitly set the right JNA version in your project. I'm aiming to get 0.9.4 released with this fixed by end of next week (Jan 25)

neilcsmith-net commented 5 years ago

This should now be fixed with the release of 0.9.4. From 0.9.5 we'll be requiring JNA 5.2+