OK, so I can barely Google anything with the terms "Snap", "Snappy", or "Snapd" with Java and Swing. But I would like to know if it is possible to run a Java Swing application using Snap.

When I install my generated snap and then try to run the application, it immediately returns without any output.

I am using the x11 plug/interface.

As a quick and simple test, I am also using the java-hello-world associated with the snapcraft example source modified with a simple "hello world" Swing source.

package oata;

import javax.swing.*;

public class HelloWorld {
     * Create the GUI and show it.  For thread safety,
     * this method should be invoked from the
     * event-dispatching thread.
    private static void createAndShowGUI() {
        //Create and set up the window.
        JFrame frame = new JFrame("HelloWorldSwing");

        //Add the ubiquitous "Hello World" label.
        JLabel label = new JLabel("Hello World");

        //Display the window.
    public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {

EDIT: OK, so a reboot has fixed my off snapd/ubuntu-core state problem. I am now back to no GUI, no output. I have forked snapcraft and modified the example for demo.

Current snap interfaces output:

matta@mirkwood:/work/Dev/snapcraft/examples/java-hello-world$ snap interfaces
Slot                 Plug
:firewall-control    -
:home                -
:locale-control      -
:log-observe         -
:mount-observe       -
:network             -
:network-bind        -
:network-control     -
:network-observe     -
:opengl              -
:snapd-control       -
:system-observe      -
:timeserver-control  -
:timezone-control    -
:unity7              -
:x11                 java-hello-world

snappy on IRC answered my question.

Fixed with snapd 2.0.3 coming out.

Launchpad bug 1574526 in Snappy "x11 plug doesn't allow getsockname, breaks xeyes"

  • 1
    Note snapd 2.0.3 (in xenial-updates since last week, meaning an update should get it to you) should address that bug. – Chipaca May 16 '16 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.