Java application shows and error when trying to play sound

Thank you, @James-Carroll! After some experimentation I was able to get sound working with OpenJDK 11 again.

The only thing that tripped me up at the end was that adding the gnome-3-28 extension caused problems with Java fonts that prevented it from running. Once I removed the extension, it worked. I don’t need it in any case. When it was present, I got Null Pointer errors having to do with the java fonts.

To summarize my changes for anyone who stumbles across this:

My issue: Sound in my java game no longer worked with newer versions of snapd in Java 8. When I built a new snap in Java 8 the sound no longer worked.

Following the link from @James-Carroll in his comment above, I did this:

Updated openjdk-8-jdk to openjdk-11-jdk.

Added this to my app environment:

ALSA_CONFIG_PATH: ${SNAP}/etc/asound.conf

Added audio-playback to my plugs.

Added a layout to normalize where alsa lib is expected to be:

layout:
  /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib:
    bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/alsa-lib

Added a new package to the runtime environment:

- libsound2-plugins

The commit is here, which might make seeing what needed doing easier:

https://github.com/jsseidel/jgalaxian/pull/14/commits/0fb9c85aabcaf86fdf7965617580ecd0ba8fb26f

And here is the snapcraft.yaml:

https://raw.githubusercontent.com/jsseidel/jgalaxian/master/snap/snapcraft.yaml

1 Like