• Post Reply Bookmark Topic Watch Topic
  • New Topic

Run Java at specified time  RSS feed

 
Maikel Geelen
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a java project serving as a Testsuite. When the project is started I am able to choose between different tests to run or even create testruns consisting of multiple tests.

Now I want to be able to let these tests or testruns run at a time that i give in.
I already created a textfield where i format the string to date.

My question is what I could use to let these tests run with the given time or at least push me in the direction I should look
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need something like Quartz
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you want your JVM to be running all the time, and have it be responsible for kicking off certain tasks at certain times? If so, then as already suggested, Quartz is one way to go.

Or do you want to invoke your java executable at a certain time? In this case, you'd use cron on Linux or whatever equivalent Windows has.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12562
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff Verdegan wrote:...or whatever equivalent Windows has.

it is a "scheduled task".
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:You need something like Quartz

Quartz is pretty old, is it still the best scheduling framework?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
surlac surlacovich wrote:Quartz is pretty old

What do you mean - the most recent release happened on 3/8/2013? And yes, it works fine, as do the java.util.Timer and TimerTask classes. As pointed out earlier, that doesn't mean that a Java solution is best in this case, though.
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:
surlac surlacovich wrote:Quartz is pretty old

What do you mean - the most recent release happened on 3/8/2013? And yes, it works fine, as do the java.util.Timer and TimerTask classes. As pointed out earlier, that doesn't mean that a Java solution is best in this case, though.

I mean the first version came on 13.09.2002, which is more than 10 years ago.
 
Dinesh Sing
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As rightly mentioned one option you have is to use Quartz.

The other possible way you can try if it just a plain java project is to create a jar file of your project. Create a batch file containing the command to execute this jar file. Schedule this batch file using the windows scheduler.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
surlac surlacovich wrote:I mean the first version came on 13.09.2002, which is more than 10 years ago.

By that logic you would need to be extremely wary of Unix, Windows, Linux and OS X :-) The fact that it is still being developed after all these years should tell you something.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12562
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
surlac surlacovich wrote:I mean the first version came on 13.09.2002, which is more than 10 years ago.

The first version of Java came out in...96? 95? maybe we should be weary of that as well...
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm not wary about Quartz, just wondering how it happened that there is no successors for such a long period. It's very often that one framework is "replaced" by another one which is "better" for particular task.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simple: Don't fix what's not broken. Quartz apparently does what people need in a scheduling software well enough that nobody has felt the itch to create something better.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
surlac surlacovich wrote:i'm not wary about Quartz, just wondering how it happened that there is no successors for such a long period.

Maybe because the designers got it right.

And on that subject, Windows' "scheduled task" is a right PITA. Trust MS to screw up a perfectly simple idea like cron.

Winston
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:...nobody has felt the itch to create something better.

Unbelievable. Every programmer have this feeling, desire to reinvent the wheel.

Winston Gutkowski wrote:
Maybe because the designers got it right.

Looks like the designers keeping up with users expectations and change design if needed, so it's still evolving.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
surlac surlacovich wrote:
Ulf Dittmer wrote:...nobody has felt the itch to create something better.

Unbelievable. Every programmer have this feeling, desire to reinvent the wheel.


False.

And even if it were true, that wouldn't mean that anybody had any desire to reinvent that particular wheel.

Winston Gutkowski wrote:
Maybe because the designers got it right.

Looks like the designers keeping up with users expectations and change design if needed, so it's still evolving.


I believe that's known as "getting it right."
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!