Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use Cron job with Java program?

 
Steven Ho
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to the Cron Job, I am trying to schedule a Java program that print current Date on System.out every 5 minutes. I put inside the command line
is "java printBeep"
But the output I get from email is

Please tell me where I went wrong, btw the interface only permits 1 line of command to input, and I can't seem to put more lines of command lines.
Please help if can, thank you all.
Have a nice day!
[ September 17, 2003: Message edited by: Steven Ho ]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use the complete path to the java file e.g. /usr/bin/java. I think
the cron job doesnt uses PATH variables, so you have to define the
absolute path
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or you can put whatever commands you like in a script file, and execute that from your "cron".
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11888
203
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way, there is no System.out from within the cron job, as there is no terminal associated with the cron job.
Depending on how your cron environment is set up, you may get an email sent to you with the output that would have appeared on the screen if there had been a screen.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic