JAVA : Making an Application as a Service in Windows / Linux Using Tanuki Wrapper

Launch any Java program / application as a service by using Tanuki Service Wrapper.
Please follow the below steps to install a java application(KTPot) as service in Windows / Linux.

Prerequisites : Wrapper Service community Edition which is free. 

  • Unzip the and copy your java application i.e jar to the "<Wrapper_Home>\lib" directory.
  • Look over the provided examples "demoapp / testwrapper" for more reference.
  • Change the below attributes in ktpotapp.conf & ktpot under "<Wrapper_Home>\bin" directory
    • APP_NAME: your service name (ie. ktpot)
    • APP_LONG_NAME: if you have a longer description (Knowledge Transfer Pot)
    • WRAPPER_CONF: file location if you wish to change
    • PRIORITY: specify nice value
    • PIDDIR: the path of where the pid file should be stored
    • RUN_AS_USER: specify the user the service should be run as
    • USE_UPSTART: flag for using upstart
    • (Optional - Java Location)
    • (application)
    • (Optional - Java Heap)
    • (Optional - Java Heap)

Steps to follow in Windows:

1. Change the set.default.JSW_HOME=D:\Services\KTPot as per module installation
2. Change the set.default.KTPOT_HOME=D:\Services\KTPot as per module installation
3. Install as service --> wrapper -i ktpotapp.conf
4. Check the status --> wrapper -q ktpotapp.conf
5. Start the service --> wrapper -t ktpotapp.conf
6. Stop the service --> wrapper -p ktpotapp.conf
7. Remove the service --> wrapper -r ktpotapp.conf
Check in Windows Services Tab.

Steps to follow in Linux:

1. Change the set.default.JSW_HOME=\usr\bin\KTPot as per module installation
2. Change the set.default.KTPOT_HOME=\usr\bin\KTPot as per module installation
3. Move to installation folder to give admin permission for command execution
4. Chmod 755 wrapper
5. Chmod 755 ktpot
6. Install as service 
--> ./ktpot install
7. Check the status 
--> ./ktpot status
8. Start the service 
--> ./ktpot start
9. Stop the service 
--> ./ktpot stop
Remove the service --> ./ktpot remove

Check in /etc/init.d/ktpot in console.