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
- wrapper.java.command=C:\ProgramFiles\Java\jdk1.6.0_07\bin\java
- Configure the main class of wrapper, if using his proxy method, fill in the ORG.TANUKISOFTWARE.WRAPPER.WRAPPERSIMPLEAPP
- wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
- Tool to find the jar package and the path to the application
- wrapper.java.classpath.1=. /lib/wrappertest.jar
- Wrapper.java.classpath.2=. /lib/wrapper.jar
- wrapper.java.classpath.3=. /lib/wrapper.dll
- The application is copied to the application folder along with its folder, so the path needs only to be specified. /application/
- wrapper.java.classpath.4=. /application/
- All the jar packages the application needs to use
- wrapper.java.classpath.5=. /application/lib/*.jar
- wrapper.java.library.path.1=. /lib
- wrapper.java.additional.1=-dprograme.name=run.bat
- To make a service of which application, write the class name where his main function is located.
- wrapper.app.parameter.1=com.timeseries.MySeries
- wrapper.console.format=PM
- wrapper.console.loglevel=INFO
- Specify where to log records
- Wrapper.logfile=. /logs/wrapper.log
- wrapper.logfile.format=Lptm
- wrapper.logfile.loglevel=INFO
- wrapper.logfile.maxsize=0
- wrapper.logfile.maxfiles=0
- wrapper.syslog.loglevel=NONE
- wrapper.console.title=wrapperapplication
- [Email protected]@
- [Email protected]@
- [Email protected]@
- wrapper.ntservice.dependency.1=
- Wrapper. ntservice.starttype=auto_start
- 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