groovy控制台X11启动时出错

问题描述:

我是perl,python家伙,新来的java和groovy。 在运行groovyConsole中groovy控制台X11启动时出错

常规工作正常,我得到这个错误。

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也不过一切都是徒劳。 帮助我,让我知道为什么会发生此错误。

Groovy的控制台是一个GUI应用程序,它看起来像你试图在不支持图形的环境中,例如运行通过telnet/SSH连接到远程机器。

一种可能的解决方法是使用Groovy的壳代替Groovy的控制台。 Groovy shell在功能上与Groovy控制台类似,但是shell是一个命令行,而不是GUI应用程序。

假设Groovy的bin目录在您的PATH变量,你应该能够通过输入groovysh运行它。