It's a different problem yes.. but you can just install XVFB: http://linux.die.net/man/1/xvfb
Problem solved
Run it with xvfb-run ./program [params]
EDIT: Use xvfb-run instead
xvfb is to set up the server, but on ubuntu you can just use xvfb-run:
http://manpages.ubuntu.com/manpages/lucid/man1/xvfb-run.1.html