• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
golla
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a java-scheduler called quarz or quartz.

How to integrate it into weblogic is beyond my knowledge.
 
Senthil B Kumar
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Aj Mathia
Ranch Hand
Posts: 478
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this may help
http://weblogic.sys-con.com/read/48929.htm
 
Vijay Vaddem
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about Timer?? check this
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic