Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

Let's say I have a small "Hello World" Java program compiled in my home directory. I can run it with java helloWorld from my home directory and it executes without any problem.

Now I need to schedule to execute this program let's say after 10mins from now. So, I am executing following commands on console:

at now+10min
warning: commands will be executed using /bin/sh
at> java helloWorld
Press CTRL+D to finish

So it is scheduled properly as I can see it with at -l command. But at this time nothing happens.

Why? What is wrong with it? Because, if instead of scheduling the execution my own program I schedule executing of gedit command it opens it at a specified time. But with my own program it doesn't perform anything. How can I change the situation?

share|improve this question
up vote 2 down vote accepted

What does helloworld do? If it is text application, you would not see the output (unless you setup to receive the cron reports to your local e-mail). If it is a GUI application, it will not work because cron cannot start GUI applications.

Therefore, try with a Java application that creates a file on your system (for example, in /tmp) and observe whether it happens.

In addition, use the MAILTO option in crontab so that you are sure that cron runs properly. The notification e-mails include the output of the program (for example, the message Hello world!) and any errors in running the commands.

share|improve this answer
It is a simple test application which shows Hello World message. – Bakhtiyor Jan 29 '11 at 14:34
I have checked out writing to the file from my application in order to see whether it has been executed or not. So, yes, it has been executed. But as you said it doesn't show print messages. – Bakhtiyor Jan 29 '11 at 15:03
When you enable the MAILTO option in crontab, you are able to see the output of the command you added. Therefore, from this e-mail you can see the output of the program you put. – user4124 Jan 29 '11 at 15:23
@user4124: Cron can start any GUI. Just add DISPLAY=:0.0 to the crontab – user189769 Sep 3 '13 at 14:00

Try giving the full path of the file, eg:

java /home/ward/prog/helloWorld
share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.