SlideShare a Scribd company logo
1 of 7
Download to read offline
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

What's hot

Automation Testing With Appium
Automation Testing With AppiumAutomation Testing With Appium
Automation Testing With AppiumKnoldus Inc.
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using SeleniumNaresh Chintalcheru
 
End to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaEnd to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaBabacar NIANG
 
BDD WITH CUCUMBER AND JAVA
BDD WITH CUCUMBER AND JAVABDD WITH CUCUMBER AND JAVA
BDD WITH CUCUMBER AND JAVASrinivas Katakam
 
DDD로 복잡함 다루기
DDD로 복잡함 다루기DDD로 복잡함 다루기
DDD로 복잡함 다루기beom kyun choi
 
Why Should we use Microsoft's Playwright
Why Should we use Microsoft's PlaywrightWhy Should we use Microsoft's Playwright
Why Should we use Microsoft's PlaywrightKnoldus Inc.
 
Flutter - it's all about widgets - Flutter Rhein-Main Meetup
Flutter - it's all about widgets - Flutter Rhein-Main Meetup Flutter - it's all about widgets - Flutter Rhein-Main Meetup
Flutter - it's all about widgets - Flutter Rhein-Main Meetup Markus Kühle
 
GraalVM Native Images by Oleg Selajev @shelajev
GraalVM Native Images by Oleg Selajev @shelajevGraalVM Native Images by Oleg Selajev @shelajev
GraalVM Native Images by Oleg Selajev @shelajevOracle Developers
 
How to go about testing in React?
How to go about testing in React? How to go about testing in React?
How to go about testing in React? Lisa Gagarina
 
Progressive Web App Testing With Cypress.io
Progressive Web App Testing With Cypress.ioProgressive Web App Testing With Cypress.io
Progressive Web App Testing With Cypress.ioKnoldus Inc.
 
Olga KURASOVA „Duomenų analizės įrankio DAMIS panaudojimas“
Olga KURASOVA „Duomenų analizės įrankio DAMIS panaudojimas“Olga KURASOVA „Duomenų analizės įrankio DAMIS panaudojimas“
Olga KURASOVA „Duomenų analizės įrankio DAMIS panaudojimas“Lietuvos kompiuterininkų sąjunga
 
20220716_만들면서 느껴보는 POP
20220716_만들면서 느껴보는 POP20220716_만들면서 느껴보는 POP
20220716_만들면서 느껴보는 POPChiwon Song
 
Fundamental of Node.JS - Internship Presentation - Week7
Fundamental of Node.JS - Internship Presentation - Week7Fundamental of Node.JS - Internship Presentation - Week7
Fundamental of Node.JS - Internship Presentation - Week7Devang Garach
 
API Automation Testing Using RestAssured+Cucumber
API Automation Testing Using RestAssured+CucumberAPI Automation Testing Using RestAssured+Cucumber
API Automation Testing Using RestAssured+CucumberKnoldus Inc.
 

What's hot (17)

Automation Testing With Appium
Automation Testing With AppiumAutomation Testing With Appium
Automation Testing With Appium
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 
End to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaEnd to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux Saga
 
Maven tutorial
Maven tutorialMaven tutorial
Maven tutorial
 
2020.02.06 우리는 왜 glue를 버렸나?
2020.02.06 우리는 왜 glue를 버렸나?2020.02.06 우리는 왜 glue를 버렸나?
2020.02.06 우리는 왜 glue를 버렸나?
 
BDD WITH CUCUMBER AND JAVA
BDD WITH CUCUMBER AND JAVABDD WITH CUCUMBER AND JAVA
BDD WITH CUCUMBER AND JAVA
 
DDD로 복잡함 다루기
DDD로 복잡함 다루기DDD로 복잡함 다루기
DDD로 복잡함 다루기
 
Why Should we use Microsoft's Playwright
Why Should we use Microsoft's PlaywrightWhy Should we use Microsoft's Playwright
Why Should we use Microsoft's Playwright
 
Introduction à ajax
Introduction à ajaxIntroduction à ajax
Introduction à ajax
 
Flutter - it's all about widgets - Flutter Rhein-Main Meetup
Flutter - it's all about widgets - Flutter Rhein-Main Meetup Flutter - it's all about widgets - Flutter Rhein-Main Meetup
Flutter - it's all about widgets - Flutter Rhein-Main Meetup
 
GraalVM Native Images by Oleg Selajev @shelajev
GraalVM Native Images by Oleg Selajev @shelajevGraalVM Native Images by Oleg Selajev @shelajev
GraalVM Native Images by Oleg Selajev @shelajev
 
How to go about testing in React?
How to go about testing in React? How to go about testing in React?
How to go about testing in React?
 
Progressive Web App Testing With Cypress.io
Progressive Web App Testing With Cypress.ioProgressive Web App Testing With Cypress.io
Progressive Web App Testing With Cypress.io
 
Olga KURASOVA „Duomenų analizės įrankio DAMIS panaudojimas“
Olga KURASOVA „Duomenų analizės įrankio DAMIS panaudojimas“Olga KURASOVA „Duomenų analizės įrankio DAMIS panaudojimas“
Olga KURASOVA „Duomenų analizės įrankio DAMIS panaudojimas“
 
20220716_만들면서 느껴보는 POP
20220716_만들면서 느껴보는 POP20220716_만들면서 느껴보는 POP
20220716_만들면서 느껴보는 POP
 
Fundamental of Node.JS - Internship Presentation - Week7
Fundamental of Node.JS - Internship Presentation - Week7Fundamental of Node.JS - Internship Presentation - Week7
Fundamental of Node.JS - Internship Presentation - Week7
 
API Automation Testing Using RestAssured+Cucumber
API Automation Testing Using RestAssured+CucumberAPI Automation Testing Using RestAssured+Cucumber
API Automation Testing Using RestAssured+Cucumber
 

Similar to Tutorial windows service with java (procrun)

Maven TestNg frame work (1) (1)
Maven TestNg frame work (1) (1)Maven TestNg frame work (1) (1)
Maven TestNg frame work (1) (1)QA Programmer
 
Part 5 running java applications
Part 5 running java applicationsPart 5 running java applications
Part 5 running java applicationstechbed
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsSteve Keener
 
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...Amit Singh
 
Maven TestNg frame work (1) (1)
Maven TestNg frame work (1) (1)Maven TestNg frame work (1) (1)
Maven TestNg frame work (1) (1)Gopi Raghavendra
 
Struts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web ApplicationsStruts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web Applicationselliando dias
 
XPages Blast - ILUG 2010
XPages Blast - ILUG 2010XPages Blast - ILUG 2010
XPages Blast - ILUG 2010Tim Clark
 
How to write a simple java program in 10 steps
How to write a simple java program in 10 stepsHow to write a simple java program in 10 steps
How to write a simple java program in 10 stepsIshara Amarasekera
 
Java, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorialJava, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorialRaghavan Mohan
 
Spring Data JPA + JSF + Maven + Mysql using Eclipse IDE
Spring Data JPA + JSF + Maven + Mysql using Eclipse IDESpring Data JPA + JSF + Maven + Mysql using Eclipse IDE
Spring Data JPA + JSF + Maven + Mysql using Eclipse IDENikhil Bhalwankar
 
Integrating Maven with Eclipse
Integrating Maven with EclipseIntegrating Maven with Eclipse
Integrating Maven with EclipseNikhil Bharati
 
JavaOne 2016: Life after Modularity
JavaOne 2016: Life after ModularityJavaOne 2016: Life after Modularity
JavaOne 2016: Life after ModularityDanHeidinga
 
Java interview question
Java interview questionJava interview question
Java interview questionsimplidigital
 
Apache Maven supports all Java (JokerConf 2018)
Apache Maven supports all Java (JokerConf 2018)Apache Maven supports all Java (JokerConf 2018)
Apache Maven supports all Java (JokerConf 2018)Robert Scholte
 

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

Tomcat + other things
Tomcat + other thingsTomcat + other things
Tomcat + other things
 
Maven TestNg frame work (1) (1)
Maven TestNg frame work (1) (1)Maven TestNg frame work (1) (1)
Maven TestNg frame work (1) (1)
 
Part 5 running java applications
Part 5 running java applicationsPart 5 running java applications
Part 5 running java applications
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable Results
 
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
 
Maven TestNg frame work (1) (1)
Maven TestNg frame work (1) (1)Maven TestNg frame work (1) (1)
Maven TestNg frame work (1) (1)
 
Struts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web ApplicationsStruts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web Applications
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
Profiling documentforaltrec
Profiling documentforaltrecProfiling documentforaltrec
Profiling documentforaltrec
 
XPages Blast - ILUG 2010
XPages Blast - ILUG 2010XPages Blast - ILUG 2010
XPages Blast - ILUG 2010
 
How to write a simple java program in 10 steps
How to write a simple java program in 10 stepsHow to write a simple java program in 10 steps
How to write a simple java program in 10 steps
 
Java, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorialJava, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorial
 
Spring Data JPA + JSF + Maven + Mysql using Eclipse IDE
Spring Data JPA + JSF + Maven + Mysql using Eclipse IDESpring Data JPA + JSF + Maven + Mysql using Eclipse IDE
Spring Data JPA + JSF + Maven + Mysql using Eclipse IDE
 
Integrating Maven with Eclipse
Integrating Maven with EclipseIntegrating Maven with Eclipse
Integrating Maven with Eclipse
 
Installing java, eclipse and maven
Installing java, eclipse and mavenInstalling java, eclipse and maven
Installing java, eclipse and maven
 
JavaOne 2016: Life after Modularity
JavaOne 2016: Life after ModularityJavaOne 2016: Life after Modularity
JavaOne 2016: Life after Modularity
 
Gradle
GradleGradle
Gradle
 
Java interview question
Java interview questionJava interview question
Java interview question
 
Arquillian in a nutshell
Arquillian in a nutshellArquillian in a nutshell
Arquillian in a nutshell
 
Apache Maven supports all Java (JokerConf 2018)
Apache Maven supports all Java (JokerConf 2018)Apache Maven supports all Java (JokerConf 2018)
Apache Maven supports all Java (JokerConf 2018)
 

More from muhammad arif nasution

More from muhammad arif nasution (10)

Excel to html
Excel to htmlExcel to html
Excel to html
 
Concordion java
Concordion javaConcordion java
Concordion java
 
Hello World Android v.01
Hello World Android v.01Hello World Android v.01
Hello World Android v.01
 
Tutorial Hello World Web Services with Apache CXF
Tutorial Hello World Web Services with Apache CXFTutorial Hello World Web Services with Apache CXF
Tutorial Hello World Web Services with Apache CXF
 
Sample jasper report (design with IReport & code sample)
Sample jasper report (design with IReport & code sample)Sample jasper report (design with IReport & code sample)
Sample jasper report (design with IReport & code sample)
 
SSIS 2005 training kit v0.01
SSIS 2005 training kit v0.01SSIS 2005 training kit v0.01
SSIS 2005 training kit v0.01
 
Tutorial web service (web & client) with spring web services
Tutorial web service (web & client) with spring web servicesTutorial web service (web & client) with spring web services
Tutorial web service (web & client) with spring web services
 
Tutorial java & mysql
Tutorial java & mysqlTutorial java & mysql
Tutorial java & mysql
 
Tutorial text database (hsqldb)
Tutorial text database (hsqldb)Tutorial text database (hsqldb)
Tutorial text database (hsqldb)
 
Cv muhammad arif nasution
Cv muhammad arif nasutionCv muhammad arif nasution
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