I'm building a spring based javafx application which is aimed to run both on Linux and Windows machines.
I've encountered an error, and couldn't find a satisfying solution to the problem.
While trying to run the command sudo java -jar MS.jar
, I'm getting InvocationTargetException
:
Caused by: java.lang.UnsupportedOperationException: Unable to open DISPLAY
Of course, while executing java -jar MS.jar
alone, everything works great.
BTW, Running echo $DISPLAY
in terminal results with ":0"
The software is a javafx UI software, which needs sudo privileges for kernel tasks.
Machine details:
OS: OpenSuse 42.1
JAVA version: "1.8.0_152"
How can I resolve this issue?
Thanks!