2

我一直在尝试使用处理中的“导出应用程序”功能为 Mac 导出一个独立的应用程序。这个简单的应用程序涉及更新屏幕上的浮点值,该值对应于 Leap Motion 检测到的手的 y 轴位置,在 Processing 中运行良好。但是,一旦我导出应用程序并尝试运行它,该应用程序会打开一秒钟然后很快关闭。我之前已经成功地从 Processing 中导出了应用程序,但没有使用 Leap SDK 的应用程序。我正在使用 LeapMotion 库进行处理来访问 Leap SDK:https ://github.com/heuermh/leap-motion-processing 。这是我的代码:

import processing.core.*;
import com.leapmotion.leap.processing.*;
import com.leapmotion.leap.Controller;
import com.leapmotion.leap.Listener;

public class Test extends PApplet {

  Controller controller;
  MyListener listener;
  float position = 0.0f;

  class MyListener extends Listener {
    public void onFrame(Controller controller) {
      if (!controller.frame().hands().isEmpty()) {
        position = controller.frame().hands().leftmost().palmPosition().get(1);
      }
    }
  }

  public void setup() {
    size(600,600);
    controller = new Controller();
    listener = new MyListener();
    controller.addListener(listener);
  }

  public void draw() {
    background(0);
    textAlign(CENTER,CENTER);
    textSize(50);
    text(position, 300,300);
  }

  public static void main(String args[]) {
    PApplet.main("Test");
  }
}

当我导出应用程序时,应用程序的内容如下:

Info.plist
Java
-core.jar
-gluegen-rt-natives-macosx-universal.jar
-gluegen-rt.jar
-jogl-all-natives-macosx-universal.jar
-jogl-all.jar
-LeapJava.jar
-LeapMotion.jar
-libLeap.dylib
-libLeapJava.dylib
-Test.jar
MacOS
-Test
Plugins
-jdk1.7.0_45.jdk
Resources
-en.lproj
-sketch.icns
PkgInfo

任何帮助将不胜感激!

PS 我已经尝试将程序捆绑到一个可运行的 JAR 文件中。

4

0 回答 0