Java swing kiosk ubuntu classic snap

I am in the unenviable position of taking an existing Java Swing app and converting it into a kiosk application on an ubuntu 16 desktop. I reviewed the ubuntu kiosk docs:
It looks like I need to convert the Java into a snap and use Case #2 (To enable these applications we will embed a tiny X11 server into your application package, which translates X11 calls to Wayland ones.)
I’ve spent some time on this and have gotten the snap to run using the mir-kios-snap-launch example. But I’m getting: Cannot run program “/usr/bin/xprop”: error=2, No such file or directory.
I assume it’s because I have not managed to get the X11 server configured correctly.

If there’s any examples or anything I would appreciate any help on this.

Here is my snapcraft.yaml:

name: java-test
description: java test
summary: This is the summary
version: "1.0"
base: core18
grade: devel
confinement: devmode
      - bin/run-daemon
      - bin/wayland-launch
    daemon: simple
    restart-condition: always
    command: bin/jt/data/
      - bin/wayland-launch
    command: bin/jt/data/
      JAVA_HOME: $SNAP/usr/lib/jvm/java-1.8.0-openjdk-$SNAP_ARCH
      PATH: $JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
    plugs: [wayland, network, opengl, unity7]
    plugin: dump
    source: .
      jt/: bin/jt/
    stage-packages: [openjdk-8-jre, openjdk-8-demo]
    plugin: dump
    override-build:  $SNAPCRAFT_PART_BUILD/ opengl pulseaudio wayland
      - inotify-tools

Also not sure on how to put code in here? It’s eating up my yaml file.

That bit I can help with: put a line with three backquotes (`) before and after.

It isn’t down to the way you’ve configured X, but because something in Java is trying to run /usr/bin/xprop and that’s not something that should be done in a confined snap (because programs from the snap are elsewhere, e.g. $SNAP/usr/bin/xprop.

But I don’t know how to change what your Java application is doing.

Thanks for sorting out the formatting, mir-kiosk-snap-launch is shown in the “native Wayland” tutorial.

Have you tried following the tutorial for an X11 application?

that’s what I’m about to look at. It spends alot of time with egmde and I wasn’t sure if that was production level or I should stick with the mir-kiosk

:question: I don’t see any mention of egmde.

Are we talking about the same things?

At the bottom:
You should be left with a “mir-kiosk-x11-example_0.1_amd64.snap” file.

Let’s test it!

sudo snap install --dangerous ./mir-kiosk-x11-example_0.1_amd64.snap

Hold on this is you:

You’re right. It does use egmde for the initial tests. How could I miss that!?

It is safe for you to do this, but I should find a way to make this less confusing.

I spent some time refactoring playing with the examples. Right now I’m getting the following error starting my Java program. I hope the error is maybe I’m on a VM? Weird drivers, etc and I hope it will disappear on the deployment HW(It’s also Ubuntu 16 :slightly_frowning_face:)

[2021-05-25 14:18:13.835038] mirserver: Starting
[2021-05-25 14:18:13.838580] < - debug - > mirserver: Not trying logind: “DISPLAY” is set and X need not have claimed the VT
[2021-05-25 14:18:13.838807] < - debug - > mirserver: Not using Linux VT subsystem for session management: Failed to find the current VT
[2021-05-25 14:18:13.838836] < - debug - > mirserver: No session management supported
[2021-05-25 14:18:13.841468] VT switch key handler: No VT switching support available: MinimalConsoleServices does not support VT switching
[2021-05-25 14:18:13.841701] mircommon: Loading modules from: /snap/mpcad/x1/usr/lib/x86_64-linux-gnu/mir/server-platform
[2021-05-25 14:18:13.841761] mircommon: Loading module: /snap/mpcad/x1/usr/lib/x86_64-linux-gnu/mir/server-platform/
[2021-05-25 14:18:13.841806] mirserver: Found graphics driver: mir:wayland (version 2.3.3) Support priority: 256
[2021-05-25 14:18:13.841823] mirserver: Selected driver: mir:wayland (version 2.3.3)
ERROR: /build/mir-ugCfbK/mir-2.3.3/src/server/graphics/default_configuration.cpp(136): Throw in function mir::DefaultServerConfiguration::the_graphics_platform()::<lambda()>
Dynamic exception type: boost::wrapexcept<std:: runtime_error>
std::exception::what: Exception while creating graphics platform
ERROR: /build/mir-ugCfbK/mir-2.3.3/src/platforms/wayland/platform.cpp(40): Throw in function mir::graphics::wayland::Platform::Platform(wl_display*, const std::shared_ptr<mir:: graphics::DisplayReport>&)
Dynamic exception type: boost::wrapexcept<std:: system_error>
std::exception::what: Failed to connect to wayland: EGL_SUCCESS (0x3000)

I can see that the server you have included detects a Wayland host and tries to connect. But then fails without providing any clue why.

It might be “weird drivers”, or not.

Here’s a recent guide to debugging in a VM: