This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes how to run Java program at specific time(without manual intervention) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to run Java program at specific time(without manual intervention)" Watch "how to run Java program at specific time(without manual intervention)" New topic
Author

how to run Java program at specific time(without manual intervention)

golla
Greenhorn

Joined: May 15, 2003
Posts: 5
Hi,

I have to run a java program (weblogic as application server)
at specific time automatically(say 12 AM every day ).

Is there any option in java or weblogic to do this.

Regards & Thanks
Golla
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
On any Unix-like system, cron is a tool specifically designed to run programs at scheduled days/times. The scheduling is quite flexible and it simply executes a shell command. If you have really complex launching requirements, put them into a shell script.

On Windows, you can use the "Scheduled Tasks" feature. I only looked at it when it first appeared but have never used it. From what I recall it should be able to handle what you need.

Now, I have no idea how you're going to have the Java application exit, but since you didn't ask I'll assume you've got that covered.

Also, it seems a bit odd to me to want to start up a WebLogic server -- a very large and complex process with lots of initialization involved -- once a day. Usually servers run all the time so they are always available. So, my question is: Do you actually want to call a running WebLogic server via HTTP/S every midnight? If so, you can use the above techniques to call a tool like wget.
golla
Greenhorn

Joined: May 15, 2003
Posts: 5
Hi David, thanks for reply..

my question is not start or run weblogic, but to run a single java program
without using cron facility. Is it possible to call(run) thru weblogic or some other way(within java program).

thanks
Golla
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
If you dont want to use the chron facility .. Think this solution , ( I feel it's not a good solution ) create a java thread that runs continously like a demon, and use the process.exec() to call ( run ) the program when specific conditions are met.


Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

There is a java-scheduler called quarz or quartz.

How to integrate it into weblogic is beyond my knowledge.


http://home.arcor.de/hirnstrom/bewerbung
Senthil B Kumar
Ranch Hand

Joined: Feb 09, 2004
Posts: 140
If you want to put that Job under control of WebLogic, then its possible. Weblogic comes with a thirdparty tool for this. I dont exactly remember this name.

Why dont you want to use CRON, isn't your target machine a unix environment. because if you are going to use any tools like a scheduler as mentioned above, or implement your own code for it, then that is also going to perform the same action. Why to unneccsarily reinvent the wheel.

If you feel, making your own code, makes it portable to windows machine also, that is also wrong. You have Task Scheduler in Windows.


Work like you don't need the money. Love like you've never been hated. Dance like nobody's watching. Sing like nobody's listening. Live like it's Heaven on Earth.
Currently I Reside Here WEBlog
Aj Mathia
Ranch Hand

Joined: Apr 11, 2003
Posts: 478
this may help
http://weblogic.sys-con.com/read/48929.htm


You think you know me .... You will never know me ... You know only what I let you know ... You are just a puppet ... --CMG
Vijay Vaddem
Ranch Hand

Joined: Feb 13, 2004
Posts: 243
How about Timer?? check this
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to run Java program at specific time(without manual intervention)