Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com 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

2 Answers 2

up vote 1 down vote accepted

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

share|improve this answer
    
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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.