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 ?

  • 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

You need to create an executable bash script. For example: java Yourcompiledcode in mystartupscript.sh and make the sh file executable by running chmod +x mystartupscript.sh. 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

  • how to create a bash script ? – Andy Frédéric Nov 11 '11 at 7:19
  • 1
    open an editor. Enter your script. Save it with a .sh extension. Use chmod +x yourscript.sh 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy