No X11 DISPLAY variable was set, but this program performed an operation which requires it

Yes. I tried but getting below error message -

java.awt.AWTError: Can’t connect to X11 window server using ‘:1’ as the value of the DISPLAY variable.