tutorial windows service with java (procrun)
DESCRIPTION
TRANSCRIPT
![Page 1: Tutorial windows service with java (procrun)](https://reader035.vdocuments.us/reader035/viewer/2022081721/54947b59b479597e6a8b5ded/html5/thumbnails/1.jpg)
Windows Service in JAVA Windows Service JAVA with procrun
11/26/2012
![Page 2: Tutorial windows service with java (procrun)](https://reader035.vdocuments.us/reader035/viewer/2022081721/54947b59b479597e6a8b5ded/html5/thumbnails/2.jpg)
1
1. Create java application project in “netbeans”.
2. Create main class with name Driver with 2 attributes (Logger with name log and Boolean with name stop
attributes), 3 static methods (main, start and stop) and fill the class with source code like this picture.
![Page 4: Tutorial windows service with java (procrun)](https://reader035.vdocuments.us/reader035/viewer/2022081721/54947b59b479597e6a8b5ded/html5/thumbnails/4.jpg)
3
5. Clean and build project to create jar file.
6. Go to your project folder, and you will find “dist” folder which generated from build and clean process.
![Page 5: Tutorial windows service with java (procrun)](https://reader035.vdocuments.us/reader035/viewer/2022081721/54947b59b479597e6a8b5ded/html5/thumbnails/5.jpg)
4
7. Go to “dist” folder and copy all files inside it
8. Create a folder for your windows service and paste all files from “dist” folder. In this sample, I create
“sample_windows_service” folder in drive d and copy procrun.exe & procrunmgr.exe to your folder and rename
it (I rename it into java_windows_service.exe & java_windows_service_mgr.exe).
![Page 6: Tutorial windows service with java (procrun)](https://reader035.vdocuments.us/reader035/viewer/2022081721/54947b59b479597e6a8b5ded/html5/thumbnails/6.jpg)
5
9. Run your renamed procrun exe (java_windows_service.exe) with this script.
java_windows_service.exe //IS//SampleService --Install="D:\sample_windows_service\java_windows_service.exe" --Jvm=auto --
Startup=auto --StartMode jvm --StartClass sample.windows.service.Driver --StartParams start --StopMode jvm --StopClass
sample.windows.service.Driver --StopParams stop --Classpath="D:\sample_windows_service\java_windows_service.jar" --
DisplayName="Sample Service JAVA"
10. You will find “Sample Service JAVA” in services.msc.
![Page 7: Tutorial windows service with java (procrun)](https://reader035.vdocuments.us/reader035/viewer/2022081721/54947b59b479597e6a8b5ded/html5/thumbnails/7.jpg)
6
11. Start “Sample Service JAVA”.
12. Check your log file path and you will find it if you succeed.
= Thank you =