"Reprint" Java Project joins the Windows service

Source: Internet
Author: User

1. Download the WRAPPPER-WINDOWS-X86-32 Series Toolkit and unzip it to <wrapper-home>.

is: http://nchc.dl.sourceforge.net/sourceforge/wrapper/wrapper-windows-x86-32-3.2.3.zip

2. Create a new directory, for example: C:\MYSERVERAPP, creating five folders below it

Bin executable folder, respectively

Conf Configuration folder

LIB Jar package folder

Logs log folder package

Application Application Package This package also creates a new lib to hold the jar package required for the application.

3, the <wrapper-home>\src\bin in the app.bat.in,installapp-nt.bat.in,uninstallapp-nt.bat.in and other documents

The Wrapper.exe under <wrapper-home>\bin is copied to the Bin directory and will be app.bat.in,installapp-nt.bat.in,

uninstallapp-nt.bat.in, etc. suffix. In is removed.

Copy the wrapper.conf file under <wrapper-home>\src\conf to the Conf directory

Copy the Wrapper.jar,wrappertest.jar and Wrapper.dll files under <wrapper-home>\lib to the Lib directory

The final package structure can be this:

C:\MyServerApp

|-bin

|-app.bat

|-installapp-nt.bat

|-uninstallapp-nt.bat

|-wrapper.exe

|-lib

|-wrapper.jar has to be.

|-wrappertest.jar

|-wrapper.dll

|-conf

|-wrapper.conf

|-logs

|-wrapper.log

|-application

If a jar package is used in the |-lib application, it is copied into this folder

|-Used to store the application (the general application is a package structure, the project inside the bin directory of the. class file with the package copy)

4. Configure the wrapper.conf configuration file for the wrapper tool

Configuring the location of a Java virtual machine

[HTML]View PlainCopy
  1. wrapper.java.command=C:\ProgramFiles\Java\jdk1.6.0_07\bin\java
  2. Configure the main class of wrapper, if using his proxy method, fill in the ORG.TANUKISOFTWARE.WRAPPER.WRAPPERSIMPLEAPP
  3. wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
  4. Tool to find the jar package and the path to the application
  5. wrapper.java.classpath.1=. /lib/wrappertest.jar
  6. Wrapper.java.classpath.2=. /lib/wrapper.jar
  7. wrapper.java.classpath.3=. /lib/wrapper.dll
  8. The application is copied to the application folder along with its folder, so the path needs only to be specified. /application/
  9. wrapper.java.classpath.4=. /application/
  10. All the jar packages the application needs to use
  11. wrapper.java.classpath.5=. /application/lib/*.jar
  12. wrapper.java.library.path.1=. /lib
  13. wrapper.java.additional.1=-dprograme.name=run.bat
  14. To make a service of which application, write the class name where his main function is located.
  15. wrapper.app.parameter.1=com.timeseries.MySeries
  16. wrapper.console.format=PM
  17. wrapper.console.loglevel=INFO
  18. Specify where to log records
  19. Wrapper.logfile=. /logs/wrapper.log
  20. wrapper.logfile.format=Lptm
  21. wrapper.logfile.loglevel=INFO
  22. wrapper.logfile.maxsize=0
  23. wrapper.logfile.maxfiles=0
  24. wrapper.syslog.loglevel=NONE
  25. wrapper.console.title=wrapperapplication
  26. [Email protected]@
  27. [Email protected]@
  28. [Email protected]@
  29. wrapper.ntservice.dependency.1=
  30. Wrapper. ntservice.starttype=auto_start
  31. Wrapper.ntservice.interactive=false

5. Run cmd

Cdc:\myserverapp\bin

App.bat Test

Installapp-nt.bat Installation

Uninstallapp-nt.bat Uninstalling the Installed services

|| ***********************************************************************||

Inside the service, the program gets the current path, not under the directory where the. class or jar file resides, but in the bin directory.

This is important. So many programs need to be configured in the Bin directory, not with the program put together under the directory.

Otherwise, the required configuration file cannot be found when the service executes.

Additional instructions: Because I am in the virtual machine to perform the above experiment, inconvenient and copy the contents of the configuration file back to the machine, so with the configuration files are copy on the Internet (may be some of the file name discrepancy, your own groping)

Reference Posts:

http://blog.csdn.net/lfsf802/article/details/22517159

http://blog.csdn.net/sunny_sailor/article/details/7403025

"Reprint" Java Project joins the Windows service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.