This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
It depends on the nature of your task. Since you're using Struts, must it be web-based? Or can you make do with a simple Java class? If a simple Java class suffice, then it would be simple, as per how you normally configure the scheduler.
If it is standalone application then you won't be able to use Struts or servlets.
But I'm not sure what you mean by "Windows scheduler". Java has its own scheduling system (based on java.util.Timer and TimerTask), but that is independent of any scheduling that happens within Windows. And it is active only as long as the JVM is active, so if you base this on an application, then that application will need to keep running permanently.
I think you can use Windows Task Scheduler to kick off any program. You could have it run "java MyProgram ..." but you probably want more control over paths and classpaths and such, so you could have Scheduler kick off a bat file that sets those variables and then runs "java MyProgram ..." And, yes, MyProgram would start in main() just like any other Java program.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Oct 15, 2006
hi Stan James,
have another doubt hope you can help me to clarify. for the codes, i need to link to database to update some records, is it that i just as per normal have all those connection statement in the method? For those connection statement, can i call from other files?
In the bat file, i need to set the classpath all those. for the classpath it has to be a full path like, C:\work\lib\lib.jar? Can i do it like C:\work\lib\*.jar?
where should i place the bat file? same place as the class file?
I tried: set CLASSPATH=C:\j2sdk1.4.2\bin;C:\Documents and Settings\informix\Desktop\iadv\build\web\WEB-INF\lib\*.jar; set PATH=C:\Documents and Settings\informix\Desktop\iadv\build\web\WEB-INF\classes\com\job;
but i got this error: Exception in thread "main" java.lang.NoClassDefFoundError: EnquiryScheduleTask ( wrong name: com/job/EnquiryScheduleTask) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) } [ May 14, 2007: Message edited by: lynn fann ] [ May 14, 2007: Message edited by: lynn fann ]