Installing ubuntu-desktop is not enough.
The problem is that, in this context, the program is run outside of an X server.
You could try to declare the DISPLAY variable before calling it, making it use your (newly installed) X server... but you'll probably have permission issues.
This would look like: export DISPLAY=:0.0
, which is the default (but is not set when you access the computer from the console).
You can look here for details on what the DISPLAY variable is and how to set it:
What is $DISPLAY environment variable
EDIT: from your additional info in the question, it seems your server is actually using "display 0", and then export DISPLAY=:0.0
should work. The reason why it doesn't is probably due to access rights - you need to log into X to be able to display anything on it. That's what I meant when talking about permissions.
Recommended solution
Another (probably better) way to deal with it and that I've used a long time ago, is to use a virtual X server like Xvfb (https://en.wikipedia.org/wiki/Xvfb)
It acts as a X server, but performs no operations. Then your application should be happy with it. It's actually one of the use cases listed on the Wikipedia entry for it.
To use it, you need to do the following:
sudo apt-get install xvfb
xvfb-run [your command]
One word of caution though: there may be a reason for your programs to want an X server. It may actually need some level of user interaction through it, and if that is the case, not being able to see what's going on will make the program useless...
I'd recommend looking for information with the program's maker, or other users of this program, rather than the Ubuntu community.
Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
– realtebo Jul 07 '16 at 08:00