Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to launch a java application when the system starts , so I created the .autostart directory in the ~/ directory. Now what should I do to make the java application starts with the system ?

share|improve this question

migrated from Nov 12 '11 at 6:43

This question came from our site for professional and enthusiast programmers.

You mean you lied in your other question when you "saw" something? – Ignacio Vazquez-Abrams Nov 11 '11 at 7:11
I just saw the tip that to launch an app with the system then the .autostart directory should be used. But he didn't say how to do ! – Andy Frédéric Nov 11 '11 at 7:14
up vote 1 down vote accepted

You need to create an executable bash script. For example: java Yourcompiledcode in and make the sh file executable by running chmod +x Just make sure that the script is in the correct directory.

EDIT 1: In KDE you have the ~/.kde/Autostart folder where you put in your scripts, which run after kde startup. In Ubuntu, you are probably using Gnome3, so you'd have to create a folder ~/.config/autostart and put the script in there

share|improve this answer
how to create a bash script ? – Andy Frédéric Nov 11 '11 at 7:19
open an editor. Enter your script. Save it with a .sh extension. Use chmod +x from the terminal. – abhinav Nov 11 '11 at 7:26
if the java class file is not in the ~/ directory which contains the .autostart directory how to write correctly the calling of the java class file in the script ? – Andy Frédéric Nov 11 '11 at 7:32
java <path-to-your-file>/youjavafile – abhinav Nov 11 '11 at 7:35

Afaik, you just have to put an executable into that folder. But why don't you use the autostart manager? System > Settings > Autostart

Btw. I think this belongs to Askubuntu

share|improve this answer

You must log in to answer this question.