JavaFX - Caused by: java.lang.UnsupportedOperationException: Unable to open DISPLAY?
<p>I'm using jdeb to generate my .deb installer for debian based distros. The application is installed with no error, but when I try running <code>service myapp start</code>it fails with the below's exception (The application keeps running but the FX scene never gets displayed):</p>

<pre><code>2016-12-30 11:19:51,468 [main] INFO  o.s.c.s.DefaultLifecycleProcessor - Starting beans in phase 0
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58)
Caused by: java.lang.UnsupportedOperationException: Unable to open DISPLAY
    at com.sun.glass.ui.gtk.GtkApplication.&lt;init&gt;(GtkApplication.java:68)
    at com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(GtkPlatformFactory.java:41)
    at com.sun.glass.ui.Application.run(Application.java:146)
    at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
    at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
    at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:675)
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:695)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
    at java.lang.Thread.run(Thread.java:745)
</code></pre>

<p>Meanwhile if I simply run <code>sudo /etc/init.d/myapp start</code> it runs with no error and my first FX scene is displayed.</p>

<p>Bellow is my maven configuration for jdeb:</p>

<pre><code>&lt;plugin&gt;
    &lt;artifactId&gt;jdeb&lt;/artifactId&gt;
    &lt;groupId&gt;org.vafer&lt;/groupId&gt;
    &lt;version&gt;1.5&lt;/version&gt;

    &lt;executions&gt;
        &lt;execution&gt;
            &lt;id&gt;appassembler&lt;/id&gt;
            &lt;phase&gt;package&lt;/phase&gt;
            &lt;goals&gt;
                &lt;goal&gt;jdeb&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
                &lt;deb&gt;${project.build.directory}/${project.build.finalName}.deb&lt;/deb&gt;
                &lt;snapshotExpand&gt;false&lt;/snapshotExpand&gt;
                &lt;!-- expand "SNAPSHOT" to what is in the "USER" env variable --&gt;
                &lt;snapshotEnv&gt;USER&lt;/snapshotEnv&gt;
                &lt;verbose&gt;true&lt;/verbose&gt;
                &lt;controlDir&gt;${basedir}/src/deb/control&lt;/controlDir&gt;
                &lt;dataSet&gt;
                    &lt;data&gt;
                        &lt;src&gt;${project.build.directory}/${project.build.finalName}-uber.jar&lt;/src&gt;
                        &lt;type&gt;file&lt;/type&gt;
                        &lt;mapper&gt;
                            &lt;type&gt;perm&lt;/type&gt;
                            &lt;prefix&gt;/opt/stone/${project.build.finalName}&lt;/prefix&gt;
                            &lt;filemode&gt;755&lt;/filemode&gt;
                            &lt;user&gt;root&lt;/user&gt;
                            &lt;group&gt;root&lt;/group&gt;
                        &lt;/mapper&gt;
                    &lt;/data&gt;
                    &lt;data&gt;
                        &lt;src&gt;src/deb/upstart/${project.build.finalName}.conf&lt;/src&gt;
                        &lt;type&gt;file&lt;/type&gt;
                        &lt;mapper&gt;
                            &lt;type&gt;perm&lt;/type&gt;
                            &lt;prefix&gt;/opt/stone/${project.build.finalName}&lt;/prefix&gt;
                            &lt;filemode&gt;755&lt;/filemode&gt;
                            &lt;user&gt;root&lt;/user&gt;
                            &lt;group&gt;root&lt;/group&gt;
                        &lt;/mapper&gt;
                    &lt;/data&gt;
                &lt;/dataSet&gt;
            &lt;/configuration&gt;
        &lt;/execution&gt;
    &lt;/executions&gt;
&lt;/plugin&gt;
</code></pre>

<p>And here's my post installation script:</p>

<pre><code>#!/bin/bash

echo Creating symblink...
sudo ln -s /opt/stone/acs/acs-uber.jar /etc/init.d/acs

echo Creating service...
sudo update-rc.d acs start 98 5 .

echo Starting service...
sudo service acs restart
</code></pre>