From Sparkfun website:
The three methods covered in this tutorial are:
rc.local - Likely the easiest and simplest way to get your program to run on boot. The downside is that tasks started with rc.local happen before the X windows system starts, which means you will not have access to graphical user interface (GUI) elements.
autostart - Used to automatically run your programs once LXDE (graphical desktop environment used by Raspbian) starts. It's slightly more complicated than rc.local, but it lets you run programs that require graphical elements.
systemd - The new and popular way to automatically start programs in Linux. It is definitely the most complicated of the three, but it allows you to run before LXDE starts, wait until you have access to other processes (e.g. networking, graphical desktop), or simply restart your program over and over again until it works. As such, it is a robust way to create and manage services that run in the background.
With systemd (example for running chromium at start-up)
Note: on Sparkfun /lib folder is specified but USE /etc system folder is best choice...
~$ sudo nano /etc/systemd/system/chromium.service
ExecStart=/bin/bash -c "export DISPLAY=:0; export XAUTHORITY=/home/pi/.Xauthority; chromium-browser"
~$ sudo systemctl daemon-reload
~$ sudo systemctl enable chromium.service
# Now you can test your service (chromium must start)
~$ sudo systemctl start chromium.service
# or for testing at startup
~$ sudo reboot
# Verify the service
~$ sudo systemctl status chromium.service
# for prevent the browser to reopen his processus when you click on the window close button, use:
~$ sudo systemctl stop chromium.service