在 Raspberry Pi 上设置 Alexa 时无法启动客户端

Unable to start client while Alexa setup on Raspberry Pi

我正尝试按照 here

给出的说明在我的 Raspberry Pi 上设置 Alexa

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

下面是我执行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[=11=](App.java:67)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access0(EventQueue.java:97)
    at java.awt.EventQueue.run(EventQueue.java:709)
    at java.awt.EventQueue.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)

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

我有同样的(我相信)问题。这是当您无法访问 X window 时造成的。我怀疑您正在通过 SSH 连接到 Pi。如果是这种情况,您要确保 X forwarding is set up,然后使用 -X 标志连接到 Pi:ssh -X IP_ADDRESS 如果您再试一次,您现在应该能够获得弹出窗口!祝你好运!