Java Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable

You need to specify the -Djava.awt.headless=true parameter at startup time.


Remove the DISPLAY variable

unset DISPLAY

This helps in most cases (e.g. starting application servers or other java based tools) and avoids to modify all that many command lines.

It can also be comfortable to add it to the .bash_profile for a dedicated app-server/tools user.


This command helped me to solve the problem:

export DISPLAY=:0