Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Time schedular for multiple batch file execution in java
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Commando
Time schedular for multiple batch file execution in java
2 Answer(s)      a year and 7 months ago
Posted in : Java Beginners


Hello All,

i have a task in which i have to design a time schedular in java in which i can automate the batch file execution for the wholw day.

For example i should have a GUI in which i can see the like calander and assign the time slot 07:00 to 9:00 for batch1.bat execution. 09:30 to 10:30 for batch2.bat execution. therfore when i open it again also than i can see which time slot is free to assign another execution.

Please help me on this.


Advertisement
View Answers

May 27, 2013 at 11:19 AM


hi friend,

Try the following code, may this will be helpful for you. Code that is being given below will help you understand how to execute a batch file as a schedule.

package net.roseindia.schedular;
import java.io.IOException;
import java.util.TimerTask;
import java.util.Date;
import java.util.Timer;
import java.util.concurrent.TimeUnit;

class Task extends TimerTask {

    public void run() {
        try {
            Runtime.getRuntime().exec("cmd.exe /c start C:\\BatchFile\\run.bat");
        } catch (IOException e) {           
            e.printStackTrace();
        }
    }
}

public class JavaSchedular {
    public static void main(String args[]) throws InterruptedException {

        Timer timer = new Timer();
        Date date = new Date();
        Task task = new Task();
        timer.schedule(task, date ,TimeUnit.SECONDS.toMillis(2));
    }
}

Thanks.



May 27, 2013 at 9:09 PM


Thanks alot for the reply. Is it possible that user should have a dialog box in which he will enter the batch file paths and enter the date and time for execution.

After this he should press a button EXECUTE and after that the batch file should run in the entered Time.

Please help me on this as i do not have much exoerinec with GUI therefore struggling with this task... :(

I am waiting for your solution.



Related Tutorials/Questions & Answers:
Time schedular for multiple batch file execution in java
Time schedular for multiple batch file execution in java  Hello All, i have a task in which i have to design a time schedular in java in which i can automate the batch file execution for the wholw day. For example i should have
Java Batch Execution
Java Batch Execution  In a statement, I am executing a batch. What is the result of the execution?  It returns the int array.The array... or within a standard transaction. Execution of the batch is not all or nothing
Advertisements
Batch file for java application
Batch file for java application  please tell me how to create the batch file for java application(using swings).the application is created with netbeans
Execution of Multiple Threads in Java
Execution of Multiple Threads in Java  Can anyone tell me how multiple threads get executed in java??I mean to say that after having called the start method,the run is also invoked, right??Now in my main method if I want
Java Execution Time Measurement(JETM)
Java Execution Time Measurement(JETM)  How can we integrate JETM in eclipse
Java Execution Time Measurement(JETM)
Java Execution Time Measurement(JETM)  Whether JETM can be implemented in Struts framework especially in Struts2. If not,tell the alternative solution
different execution time - Java Beginners
different execution time    hello, when i run the bellow code more than one time i am getting different execution time("Total time taken"), Ex... java code therefore due to the execution of other many processes into the system
multiple file upload at a time like gmail
multiple file upload at a time like gmail  I want to upload multiple files at a time like gmail. is there any possiblity/solution to do that?   Hi Friend, Please visit the following link: Upload Multiple Files Thanks
Java example to calculate the execution time
Java example to calculate the execution time       get execution time This example program will describe you the way that how one can calculate or get the execution time
Take input in batch file
Take input in batch file  How to take input in batch file? Thanks   Hi, You can use the following line of code in your batch file: set /p myfile=Enter file name: In the above code myfile variable will hold the data
to know execution time
to know execution time  Hai this is sravanthi Is there any possibility to know the execution time of an SQL in its order to execute... to know the execution time for where,having and group by separately.If
run a batch file through javascript
run a batch file through javascript   How to run a batch file through javascript without prompting
execution time calculation - JSP-Servlet
execution time calculation  I want to know how to find out execution time of an algorithm in java thread program.Pls send me an example of a thread program in which i can calculate the execution time of my program.  Hi
to know sql qyery execution time
to know sql qyery execution time  Hai this is sravanthi Is there any possibility to know the execution time of an SQL in its order to execute... possibility to know the execution time for where,having and group by separately.If
to know sql qyery execution time
to know sql qyery execution time  Hai this is sravanthi Is there any possibility to know the execution time of an SQL in its order to execute... possibility to know the execution time for where,having and group by separately.If
How to Increase Script Execution Time Limit in php ?
avoid this error by increasing script execution time limit in your PHP.INI file...How to Increase Script Execution Time Limit in php ?   Increase Script Execution Time Limit in php configuration   Sometimes you need
maximum execution time of 30 seconds exceeded in php
maximum execution time of 30 seconds exceeded in php  My PHP program is taking long time to run it is giving following error: Maximum execution time of 30 seconds exceeded in php file How to resolve this issue? Thanks
can i estimate estimate execution time for a method without knowing implementation details of a method - Java Interview Questions
can i estimate estimate execution time for a method without knowing implementation details of a method  hi all, can i estimate estimate execution time for a method without knowing implementation details of a method. Thanks
Java Execution
Java Execution  How can you load DLL files when your java class is loading first time
problem at the time of execution - JSP-Servlet
problem at the time of execution  when i was running web applications the exception i.e 404 resource is not available what it means and where it occures what is the solution   Hi Friend, This error occurs when
Running Batch files in java - Java Beginners
reads a windows batch file and executes it. The program should read each and every line from the batch file and execute it line by line in java. Is anyone... are sending you some sample program code for running batch (.bat) file in Java. We have
Merge multiple jasper file to one word Doc using java
Merge multiple jasper file to one word Doc using java   how to Merge multiple jasper file to one word Doc using java
Sort last modified file time in java
Sort last modified file time in java  How to sort the last modified file time in java?   import java.io.*; import java.util.*; import...[] args) throws IOException { File file = new File("C:/file.txt
quartz schedular in spring mvc
quartz schedular in spring mvc  how to apply auto emailing through sping mvc and want to pass some variable to that trigger job
How can we increase the execution time of a php script?
How can we increase the execution time of a php script?  How can we increase the execution time of a php script
how to execute a file in java at regular time intrevals automattically
how to execute a file in java at regular time intrevals automattically  how to execute a file in java at time retrievals automatically
execution of java program
execution of java program  wat are the steps for the execution of the servlet-jdbc program on tomcat 5.5 server.. PlS provide..the execution steps in detail..including the setting of classpath in DOS for mysql-connector-java. i
Running a stand alone application using batch file in windows
Running a stand alone application using batch file in windows  I have created a stand alone application and i have generated jar file for my... following command to run my application java -classpath ".\filecreate.jar
how to sort multiple key columns in CSV file - Java Beginners
how to sort multiple key columns in CSV file  Hi Any one can assist how to sort the multiple key columns in CSV file? Any example will be appreciated. Thanks
Beep in Execution - Java Beginners
file in java but while executing it emitts beep sound everytime it reads from the file and displays the contents of doc file in command prompt. So help me... for my "file reading" problem
Multiple File Upload in PHP
Multiple File Upload in PHP  Hi, I am beginner in PHP scripting language. I am very interested to learn PHP application. So, can anyone explain or provide related reference about how to Multiple file upload in PHP. Thanks
 

 

 

DMCA.com