views:

22

answers:

2

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.

A: 

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.

Don
A: 

I had the same problem. And I had fixed it changing my firewall settings (used firestarter) that prevents some applications from accesing the x server

Bob