0

我正在尝试按照此处给出的说明在我的 Raspberry Pi 上设置 Alexa

但是我在启动客户端(mvn exec:exec)时遇到了 Java 异常

下面是我执行时的终端输出mvn exec:exec,我已经尝试了所有相关的线程,但没有任何效果。

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Alexa Voice Service Sample Java Client 20160207.3
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- exec-maven-plugin:1.2.1:exec (default-cli) @ sample-java-client ---
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at java.awt.EventQueue.invokeAndWait(EventQueue.java:1321)
    at java.awt.EventQueue.invokeAndWait(EventQueue.java:1296)
    at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1348)
    at com.amazon.alexa.avs.App.<init>(App.java:67)
    at com.amazon.alexa.avs.App.<init>(App.java:53)
    at com.amazon.alexa.avs.App.main(App.java:48)
Caused by: java.awt.HeadlessException: 
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
    at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)
    at java.awt.Window.<init>(Window.java:536)
    at java.awt.Frame.<init>(Frame.java:420)
    at java.awt.Frame.<init>(Frame.java:385)
    at javax.swing.JFrame.<init>(JFrame.java:189)
    at com.amazon.alexa.avs.ui.MainWindow.<init>(MainWindow.java:41)
    at com.amazon.alexa.avs.App.createViews(App.java:91)
    at com.amazon.alexa.avs.App.lambda$new$0(App.java:67)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

我也尝试了 s udo mvn -e install,在这种情况下构建成功,但我没有得到带有注册令牌的 URL 的弹出窗口。

4

1 回答 1

1

我有同样的(我相信)问题。它是在您无法访问 X 窗口时引起的。我怀疑您正在通过 SSH 连接到 Pi。如果是这种情况,你要确保设置了 X 转发,然后使用 -X 标志连接到 Pi:ssh -X IP_ADDRESS如果你再试一次,你现在应该可以得到你的弹出窗口了!祝你好运!

于 2017-05-15T02:27:07.610 回答