JavaFX - Caused by: java.lang.UnsupportedOperationException: Unable to open DISPLAY? JavaFX - Caused by: java.lang.UnsupportedOperationException: Unable to open DISPLAY? linux linux

JavaFX - Caused by: java.lang.UnsupportedOperationException: Unable to open DISPLAY?


Quoting an answer from elsewhere that worked for me with javafx as root on Ubuntu ...Maybe this can help someone else. I had the same question as you but for a normal user. Let's say I want to start firefox using the user account foo. I'm logged in as bar:

[bar@localhost ~]$ sudo -u foo -H firefox

Sadly that command failed with the same error as in the question (i.e. no protocol specified & cannot open display)

My solution was to simply add the user foo to the list of authorised access to the X server.

xhost si:localuser:foo

And that was it, I was then able to launch Firefox (and other X application) using sudo and the user foo.