首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Java/Swing为项目开发一个Snap包

使用Java/Swing为项目开发一个Snap包
EN

Ask Ubuntu用户
提问于 2016-04-28 18:38:44
回答 1查看 680关注 0票数 6

好吧,所以我几乎不能用"Snap“、"Snappy”或"Snapd“这几个术语搜索Java和Swing。但是我想知道是否可以使用Snap运行Java应用程序。

当我安装生成的snap,然后尝试运行应用程序时,它会立即返回而不需要任何输出。

我正在使用x11插头/接口。

作为一个快速和简单的测试,我还使用了与快照示例源相关的java世界,修改了一个简单的"hello“Swing源代码。

代码语言:javascript
复制
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");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

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

        //Display the window.
        frame.pack();
        frame.setVisible(true);
    }
    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() {
                createAndShowGUI();
            }
        });
    }
}

编辑:好的,所以重新启动解决了我的off快照/ubuntu核心状态问题。我现在回到没有GUI,没有输出。I 已经分叉管理器并修改了演示示例。

当前快照接口输出:

代码语言:javascript
复制
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
EN

回答 1

Ask Ubuntu用户

回答已采纳

发布于 2016-05-04 00:01:43

对IRC的快速分析回答了我的问题。

修正了快照2.0.3即将发布的问题。

“x11插件不允许使用getsockname,破坏xeyes”中的启动板bug 1574526

票数 3
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/764496

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档