Results 1 to 3 of 3
- 12-03-2008, 05:47 AM #1
Member
- Join Date
- Dec 2008
- Posts
- 2
- Rep Power
- 0
Is there any way to run java file through command prompt of .jar
Hi *,
I have created a jar and deployed in server which runs fine :)
now i want to keep a java file in it with public static void main functionality, which i want to run through command prompt after some time or when ever i want is it possible to do so?
Thanks and Regards,
Sachin Parnami
- 12-03-2008, 01:19 PM #2
Show us the code,if understood you correctly,then you do that with arguments
- 12-03-2008, 01:24 PM #3
Member
- Join Date
- Dec 2008
- Posts
- 2
- Rep Power
- 0
import java.util.Date;
import org.quartz.CronTrigger;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
public class QuartzRunImpl extends QuartzSchedulerImpl{
String jobName = "job1";
String groupName = "group1";
public QuartzRunImpl() {
super();
}
public static String entityName;
public void run() throws Exception {
try {
Scheduler scheduler = (Scheduler) getScheduler();
JobDetail jobDetail = (JobDetail) getJobDetail();
jobDetail.setName(entityName);
jobDetail.setGroup(groupName);
jobDetail.setJobClass(QuartzResourceAdaptor.class) ;
Date temp = getTime();
// will trigger job in every 20 seconds
CronTrigger cronTrigger = (CronTrigger) getCronTrigger("jobName",
"jobGroup", entityName, groupName, "0/20 * * * * ?");
// SimpleTrigger trigger = (SimpleTrigger) getSimpleTrigger(jobName,
// groupName , temp);
scheduler.addJob(jobDetail, true);
scheduler.scheduleJob(cronTrigger);
scheduler.start();
Thread.sleep(90L * 1000L);
scheduler.shutdown(true);
} catch (Exception e) {
System.out.println("##### EXCEPTION AT QUARTZ RUN ######" + e);
}
}
public static void main(String args[]) throws Exception{
QuartzRunImpl quartzRun= new QuartzRunImpl();
quartzRun.run();
System.out.println("########################## -----------QuartzRun---------###########################");
}
}
thats the file which is being deployed with other java files in JAR which is not being used untill explicitlly invoked :)
here is the jar details
META_INF
xyz.class
abc.class
zzz.class
Similar Threads
-
how to run windows command prompt in java parogram ?
By indikasampath2000 in forum AWT / SwingReplies: 4Last Post: 12-16-2008, 06:51 AM -
help me!!!! about command prompt..
By kureikougaiji in forum New To JavaReplies: 2Last Post: 11-13-2008, 06:15 PM -
Running eclipse java project on command prompt
By hnmapara in forum New To JavaReplies: 1Last Post: 07-09-2008, 08:29 AM -
accessing command prompt using java (netbeans)...
By kureikougaiji in forum New To JavaReplies: 6Last Post: 06-27-2008, 03:01 PM -
Problem during executing Command Prompt
By keshari in forum Advanced JavaReplies: 4Last Post: 06-05-2008, 04:06 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks