Starting Up Programs Automatically With LXDE

Is there a way to automatically startup programs when logging into LXDE? Trying to get a program (shellscript) to automatically run when a user logs in to LXDE.

Further detail for Nick’s post:

We’re using the debian 7 armhf lxde sdcard distribution with kernel 3.8.13-bone67 on the Beaglebone Black.

The objective is to automatically start an embedded java program using a shell script when the user logs on.

  1. The script executes properly from the user’s home directory when executed in the normal fashion from a terminal, i.e.

  2. The content of the shell script is straightforward:


Start jOrgan and autoload the disposition.

java -jar ~/jOrgan-3_20/jorgan.jar

  1. To achieve the autostart at login of a specific user we have followed the standard LXDE application startup scenario:
  • log in as the user
  • edit the autostart file located in ~/.config/lxsession/LXDE
  • add an entry (line) of the form @<application_name>
  • save the file and log out
  • log in as the user again
  1. To test (3) the following lines wre appended to the autostart file. At login both the leafpad and lxterminal applications were auto-started as intended.


  1. To test running a command from the command line the following line was appended to the autostart file. This appeared to do nothing at log in other than start the Leafpad application. The Lxterminal application was not visible.

So, the question is, why does this not work? How do we get a command-line shell script to execute at login?

Automatically starting the shell script when logging into LXDE works fine in a Lubuntu 12.04 VM. For some strange reason the same thing can’t be done on the BBB. No error messages appear anywhere, a real mystery. There may be an issue with Java since some of the other shell scripts (not using Java) start up without any issues on the BBB.

I’d start by checking file permissions, and running processes on both systems. After that, I’m not sure what I’d check, but would depend on what I found after doing multiple google searches.

There has to be something that is different, obviously. However, I’m nearly 100% positive that it has nothing to do with the hardware its self. I say nearly, because like anyone else. I can not know everything.

No, I don’t believe that it is the hardware either. I think that its likely to be either:

  • the implementation of debian/LXDE on the ARM platform, OR

  • some difference in implementation for the the JAVA SE Embedded jre product compared with the standard JAVA SE jre product

As another test, we replicated the shell script and .desktop file to a standard PC running Lubuntu 12.04 LXDE. We installed Oracle JAVA SE 1.8.0_25 and the same version of the jOrgan application as used on the ARM platform. The autostart mechanism and files were identical to what has been set up on the Beaglebone. The autostart process works flawlessly on the PC. The onnly difference there is that we were using JAVA SE 1.8.0 on the PC vs JAVA SE Embedded 1.8.0 on the Beaglebone, but I’m stuggling to see that the embedded version of JAVA would create that problem.

The question now is how to isolate this problem further. Trying to redirect the console output for the JAVA command in the shell script file to a text file does not work.

I don’t see how it can be a permissions issue - the scrpt file when invoked manually as the user runs just fine and starts the application.

Are there some log files I can review that might help point to the cause??

Just to recap:

  • the autostart process (via the .desktop file located in /etc/xdg/autostart) does execute the shell script file

  • if a standard application is added to the shell script file in the user’s home directory the application is started as intended

  • if a standard command (e.g. ls -l > list.txt) is added ot the shell script file it too is run correctly

  • this command, when added to the shell script in the user’s home directory does not successfully execute on the Beaglebone (it does on a PC running LUbuntu):

java -jar /home/organ/jOrgan-3_20/jorgan.jar

I don't know what might be causing your particular problem, but looking
at your command above some generic *nix debugging tips come to mind:

* Try specifying a full path to everything (ie: /path/to/java -jar ..)

* Are there any environment variables that might affect the operation of
java if they are present or absent?

* Check all runtime assumptions (effective user, ulimits, environment,
I/O redirects, etc). Often things like cron scripts and startup scripts
execute in "peculiar" environments that cause weird head-scratching

Eric, perhaps this is a post “worthy” of stackoverlfow ? There are plenty of very knowledgeable individuals who may have had similar experience with embedded versus “PC” Java implementations.

I honestly do not know much about Java in either case, but my gut instinct tells me this problem has to do with the different platform implementations.

Seems as though there is some strange differences in behaviour going on between the ARM version of LXDE and the x86 version with the way programs are automatically started, specifically the Java ones. Would it be possible to have Robert Nelson look into this issue with LXDE?

Nick, how about setting up a shell script, something simple that fires up an already included binary when you log in. That is, to make sure it’s not the Java library ? Assuming you have not done so already.