SlideShare a Scribd company logo
Windows Service
in JAVA
Windows Service JAVA with procrun




11/26/2012
arifnasution@ymail.com

   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.




                                                                                                                    1
arifnasution@ymail.com

   3. Create log4j.properties.




   4. Add log4j jar library to your project.




                                               2
arifnasution@ymail.com

   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.




                                                                                                                 3
arifnasution@ymail.com

   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).




                                                                                                               4
arifnasution@ymail.com

   9. Run your renamed procrun exe (java_windows_service.exe) with this script.

 java_windows_service.exe //IS//SampleService --Install="D:sample_windows_servicejava_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_servicejava_windows_service.jar" --
                                            DisplayName="Sample Service JAVA"




   10. You will find “Sample Service JAVA” in services.msc.




                                                                                                                             5
arifnasution@ymail.com

   11. Start “Sample Service JAVA”.




   12. Check your log file path and you will find it if you succeed.




                                                          = Thank you =

                                                                          6

More Related Content

PPTX
[PR12] PR-050: Convolutional LSTM Network: A Machine Learning Approach for Pr...
PDF
NDC21_게임테스트자동화5년의기록_NCSOFT_김종원.pdf
PDF
5G for onboard racing car video
PDF
Unite 2013 optimizing unity games for mobile platforms
PPTX
Scaling CPU Experiences: An Introduction to the Entity Component System
PPTX
유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기
PPTX
Unity - Internals: memory and performance
PDF
프로그래머가 알아야 하는 메모리 관리 기법
[PR12] PR-050: Convolutional LSTM Network: A Machine Learning Approach for Pr...
NDC21_게임테스트자동화5년의기록_NCSOFT_김종원.pdf
5G for onboard racing car video
Unite 2013 optimizing unity games for mobile platforms
Scaling CPU Experiences: An Introduction to the Entity Component System
유니티 + Nodejs를 활용한 멀티플레이어 게임 개발하기
Unity - Internals: memory and performance
프로그래머가 알아야 하는 메모리 관리 기법

What's hot (20)

PPTX
Tutorial on sequence aware recommender systems - UMAP 2018
PPTX
소셜게임 서버 개발 관점에서 본 Node.js의 장단점과 대안
PDF
에버플래닛의 글로브뷰 렌더링 NDC2011
PDF
Music recommendations @ MLConf 2014
PDF
Building Data Pipelines for Music Recommendations at Spotify
PDF
[NDC21] <쿠키런: 킹덤> 서버 아키텍처 뜯어먹기! - 천만 왕국을 지탱하는 다섯가지 핵심 기술
PPTX
Storage as a service and OpenStack Cinder
PDF
Reactive Applications in Java
PDF
Windows IOCP vs Linux EPOLL Performance Comparison
PPTX
Deep Reinforcement Learning
PDF
MMO Design Architecture by Andrew
PPTX
Unreal python
PDF
State-Based Scripting in Uncharted 2: Among Thieves
PDF
Duolingo App Notification Technology Breakdown
PPTX
Collaborative Filtering at Spotify
PDF
Machine learning @ Spotify - Madison Big Data Meetup
PDF
인공지능의 음악 인지 모델 - 65차 한국음악지각인지학회 기조강연 (최근우 박사)
PPTX
마비노기듀얼 이야기-넥슨 김동건
PDF
[야생의 땅: 듀랑고] 지형 관리 완전 자동화 - 생생한 AWS와 Docker 체험기
PDF
Horizon Zero Dawn: The Early Days
Tutorial on sequence aware recommender systems - UMAP 2018
소셜게임 서버 개발 관점에서 본 Node.js의 장단점과 대안
에버플래닛의 글로브뷰 렌더링 NDC2011
Music recommendations @ MLConf 2014
Building Data Pipelines for Music Recommendations at Spotify
[NDC21] <쿠키런: 킹덤> 서버 아키텍처 뜯어먹기! - 천만 왕국을 지탱하는 다섯가지 핵심 기술
Storage as a service and OpenStack Cinder
Reactive Applications in Java
Windows IOCP vs Linux EPOLL Performance Comparison
Deep Reinforcement Learning
MMO Design Architecture by Andrew
Unreal python
State-Based Scripting in Uncharted 2: Among Thieves
Duolingo App Notification Technology Breakdown
Collaborative Filtering at Spotify
Machine learning @ Spotify - Madison Big Data Meetup
인공지능의 음악 인지 모델 - 65차 한국음악지각인지학회 기조강연 (최근우 박사)
마비노기듀얼 이야기-넥슨 김동건
[야생의 땅: 듀랑고] 지형 관리 완전 자동화 - 생생한 AWS와 Docker 체험기
Horizon Zero Dawn: The Early Days
Ad

Similar to Tutorial windows service with java (procrun) (13)

PDF
How to create C# Windows Service Application
PDF
MSI Run-Time Logging and Debugging
PPTX
Fun with windows services
PDF
Types of MSI Custom Actions
PDF
Iz Pack
PDF
Part 5 running java applications
PDF
Fixing Design-Time Validation Errors
PDF
An introduction to OSGi
PDF
Javase7 1641812
PDF
Cloud and OSGi at eBay - OSGi Cloud Workshop March 2012
PPTX
Classpath
ODP
jBPM, open source BPM
PPT
Troubleshooting the Windows Installer
How to create C# Windows Service Application
MSI Run-Time Logging and Debugging
Fun with windows services
Types of MSI Custom Actions
Iz Pack
Part 5 running java applications
Fixing Design-Time Validation Errors
An introduction to OSGi
Javase7 1641812
Cloud and OSGi at eBay - OSGi Cloud Workshop March 2012
Classpath
jBPM, open source BPM
Troubleshooting the Windows Installer
Ad

More from muhammad arif nasution (10)

PDF
Excel to html
PDF
Concordion java
PDF
Hello World Android v.01
PDF
Tutorial Hello World Web Services with Apache CXF
PDF
Sample jasper report (design with IReport & code sample)
PDF
SSIS 2005 training kit v0.01
PDF
Tutorial web service (web & client) with spring web services
PDF
Tutorial java & mysql
PDF
Tutorial text database (hsqldb)
PDF
Cv muhammad arif nasution
Excel to html
Concordion java
Hello World Android v.01
Tutorial Hello World Web Services with Apache CXF
Sample jasper report (design with IReport & code sample)
SSIS 2005 training kit v0.01
Tutorial web service (web & client) with spring web services
Tutorial java & mysql
Tutorial text database (hsqldb)
Cv muhammad arif nasution

Tutorial windows service with java (procrun)

  • 1. Windows Service in JAVA Windows Service JAVA with procrun 11/26/2012
  • 2. arifnasution@ymail.com 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. 1
  • 3. arifnasution@ymail.com 3. Create log4j.properties. 4. Add log4j jar library to your project. 2
  • 4. arifnasution@ymail.com 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. 3
  • 5. arifnasution@ymail.com 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). 4
  • 6. arifnasution@ymail.com 9. Run your renamed procrun exe (java_windows_service.exe) with this script. java_windows_service.exe //IS//SampleService --Install="D:sample_windows_servicejava_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_servicejava_windows_service.jar" -- DisplayName="Sample Service JAVA" 10. You will find “Sample Service JAVA” in services.msc. 5
  • 7. arifnasution@ymail.com 11. Start “Sample Service JAVA”. 12. Check your log file path and you will find it if you succeed. = Thank you = 6