启动时 groovyConsole X11 错误
我是 Perl、Python 爱好者,也是 Java 和 Groovy 的新手。 我在运行 groovyConsole 时收到此错误
groovy 工作正常。
myhome:~/gscripts # groovyConsole
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:108)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:130)
Caused by: java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
我也将此添加
DISPLAY=:0.0
export DISPLAY
到 /home/me/.bask_profile 和 /home/me/.bashrc 但一切都是徒劳的。 帮助我,让我知道为什么会出现这个错误。
I am perl, python guy and new to java and groovy.
I am getting this error while running groovyConsole
groovy is working fine.
myhome:~/gscripts # groovyConsole
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:108)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:130)
Caused by: java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
I have added this
DISPLAY=:0.0
export DISPLAY
To /home/me/.bask_profile and /home/me/.bashrc also But all in vain.
Help me, let me know why this error occurs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
groovy 控制台是一个 GUI 应用程序,看起来您正在尝试在不支持图形的环境中运行它,例如通过 telnet/SSH 连接到远程计算机。
一种可能的解决方法是使用 Groovy shell 而不是 Groovy 控制台。 Groovy shell 在功能上与 Groovy 控制台类似,但 shell 是命令行,而不是 GUI 应用程序。
假设 Groovy bin 目录位于您的 PATH 变量中,您应该能够通过输入 groovysh 来运行它。
The groovy console is a GUI app and it looks like you're trying to run it in an environment that doesn't support graphics, e.g. connecting to a remote machine via telnet/SSH.
A possible workaround is to use the Groovy shell instead of the Groovy console. The Groovy shell is functionally similar to the Groovy console, but the shell is a command-line, rather than a GUI app.
Assuming the Groovy bin directory is on your PATH variable, you should be able to run it by typing
groovysh
.