I am trying to start a java SWT application after the system has booted and the user has logged in on a debian based distro (RaspbianOS on a Raspberry Pi). Therefore I have added the line sh <path>/startProgram.sh into the rc.local file.

I know that the start-script is getting called because I created a new directory for debug purposes in this script. Apart from that the script looks like this:

java -jar /home/pi/Downloads/AlarmClock.jar

And if I double click it manually it starts the application just fine. However it won't start at boot of the system. My first thought was that the X-server has not yet been initialized at that point but according to this article the rc.local script is the very last init script to run and therefore the x-server should be initialized by then (at least according to my understanding)

Does anyone has an idea on how to start the program that will create a GUI after user login?

  • You don't tell us if your program needs a running Xserver instance and a window manager. The service "x11-common", which is started at boot, does not start the Xserver - it's task is to "set up the X server and ICE socket directories". The Xserver and window manager is started by lightdm when logging in.
    – ridgy
    Commented Apr 23, 2017 at 12:10
  • Well I am creating a graphical user interface via SWT therefore I simply assumed that I need the Xserver running for that...
    – Raven
    Commented Apr 23, 2017 at 12:43
  • Could it be that I need to place my script into /etc/X11/xinit/xinitrc.d? Or does that directory serve another purpose?
    – Raven
    Commented Apr 23, 2017 at 12:51
  • As stated before there is no Xserver running after boot, and no GUI application possible before logging in - see freedesktop.org/wiki/Software/LightDM. If you want to have some program running with GUI before logging in, try to get familiar with greeters
    – ridgy
    Commented Apr 23, 2017 at 12:54
  • xinitrc(global or userlocal) is run by xinit. This is used to manually start the Xserver; I don't believe you can have an Xserver started this way at boot and in parallel have a displaymanager for logging in...
    – ridgy
    Commented Apr 23, 2017 at 13:01

1 Answer 1


Okay it turned out the way to go is to create a dektop entry in ~/.config/autostart that then runs the script starting my application (I guess it would also work when starting it directly from there).

A desktop entry has to have the extension .desktop otherwise it won't work even if the content is correct.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .