Jcrontab simple introduction example details
This example shares a simple introduction to jcrontab for your reference. The specific contents are as follows
Create a Java Web project
1. First, download the relevant jar package of jcrontab, jcrontab-2.0-rc0 jar。 Put it in the Lib folder.
2. Create a new file jcrontab.exe under Src Properties are as follows:
This is the job scheduling rule org jcrontab. data. file =E:/EclipseWorkspace/ADemo/WebContent/WEB-INF/crontab. XML #sax parsing driven type org xml. sax. driver=org. apache. xerces. parsers. Saxparser #datasource file type org jcrontab. data. datasource=org. jcrontab. data. XMLSource
3. Create a new file crontab. Under web-inf xml
Baidu the above attributes yourself, < seconds > 0,55 < / seconds > this is a multiple of 5 to call the job
4、web. The XML configuration is as follows
5. In Xu Create two new java files under the crontab package (see the screenshot at the top for the file location) [ignore other java files]
LoadCrontabServlet. java
Crontab1. java
After starting tomcat, you can see that the job is called every 5 seconds. I hope you can go well.
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.