How to task scheduler module to load external classes?

I'm trying to create a task scheduler module with GUI using which I can add/update/delete a task and start/stop a task. The task would be to load an external class file and execute that file. I'm using java util timer for creating the scheduler.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
That is a very general/generic description of what you are trying to do, can you provide more specific information, ie. have you been able to start any of this, are you just after some general direction on how to do this, etc.

Even so some more information around the following would be helpful...

Are you thinking of a web based GUI or a desktop app GUI?
Do you need a persistent storage of these tasks (ie. database, file storage) or just keep them in memory (ie. they are lost each time you quite and restart the app). You've tagged this question with "Spring Hibernate", is this what you are thinkin about for implementing task storage?
"Execute a class file" do you see that these class files will be classes that implement a common interface so that they can be called, or are they classes that have a normal "public static void main" method or is there some other way that you see them being executed?
spectrumsofttechAuthor Commented:
I'm looking for a web based GUI.

Suppose there is a module to copy some file from a folder to another folder. From GUI, I can add the details like time interval for running this task. Also, I can start/ stop this task whenever I need.

Details entered through GUI will be saved in database.

Whenever I start the task, the class where the code for copying file is written should be invoked. This class is not a "public static void main class".  It would be class which would implement Task interface.

It would be something like this:

public class SchedulerClass implements Task {

	public void execute() {

		/* From this method the class of the scheduler is called */


	public boolean isExecuting() {
		// TODO Auto-generated method stub
		return false;

	public void shutdown() {
		// TODO Auto-generated method stub


	public void initialize(TaskDefinition arg0) {
		// TODO Auto-generated method stub



Open in new window

Hope this is helpful...
Sharon SethCommented:
No need to reinvent the wheel , all that is already available in a java framework called quartz scheduler . Just plug and play unless you don't want to use this lib.
mccarlIT Business Systems Analyst / Software DeveloperCommented:
I'm looking for a web based GUI.
Then you will probably need to investigate some Java web technologies, such as Servlets/JSP at the lower basic level, through MVC frameworks such as Spring MVC and Struts, to full-blown rich app frameworks like JSF, etc.

the details like time interval for running this task
For the task scheduling you can, as sharonseth says, use a third party library such as Quartz. One advantage of this is that it has job persistance (to a database) built in. If you end up using Spring (if you use it for the web GUI side fo things), there is also a middle ground between something like Quartz and your basic java.util.Timer, and that is using Spring's built Task and Scheduling support.

The task would be to load an external class file and execute that file.
I am assuming by this that you mean the class to execute is dynamic, in that it could be a different class depending on parameters configured for the task through the GUI. If the class file for these classes can be located in the application's classpath, then you can use Class.forName("xxxxxx"); to load that class dynamically. If the class file CAN'T be located on the classpath, ie. if the user should be able to configure the task specifying any path on the system (or even being able to upload a class file from the web GUI), than you will likely need to implement your own ClassLoader to do that. Than you can use the Class.forName("xxxxxx", true, myClassLoader); method to load a class via a custom class loader.

I'm not sure whether this is evident or not, but the work ahead of you is fairly extensive and complex and hence why it is hard to just say "do this and this and there is your working solution". If you don't already know a bit about all of the above things, you are either going to have to do a bit of research and learn a lot to be able to do it yourself (and definitely, if/when you have specific problems with getting something working, that's when we can provide more specific help) or otherwise you might need to consider paying someone to develop this for you.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.