Java service wrapper: configure the Java console program as a Windows Service

Source: Internet
Author: User
Loading editor... java service wrapper configuration Java Console Program For Windows

1. Download the toolkit of the wrappper-windows-x86-32 series, decompress .
2. Create a directory, such as c: \ myserverapp, and create five folders under it.
They are: Bin executable program folders
CONF configuration folder
Lib jar package folder
Logs log folder
Application package this package also creates a new Lib to store the jar package required by the application.
3. Set App. bat. In \ SRC \ bin, InstallApp-NT.bat.in, UninstallApp-NT.bat.in, and other files
And Copy wrapper.exe under \ bin to the bin directory, and copy app. bat. In, InstallApp-NT.bat.in,
Remove the suffix. In such as UninstallApp-NT.bat.in.
Set Copy the wrapper. conf file under \ SRC \ conf to the conf directory.
Set Copy wrapper. jar, wrappertest. jar and wrapper. DLL files under \ Lib to the lib directory
The final package structure can be like this:
C: \ myserverapp
|-Bin
|-App. bat
|-InstallApp-NT.bat
|-UninstallApp-NT.bat
| -Wrapper.exe
|-Lib
|-Required for wrapper. Jar
|-Wrappertest. Jar
|-Wrapper. dll
|-Conf
|-Wrapper. conf
|-Logs
|-Wrapper. Log
|-Application
|-If the jar package is used in the Lib application, it will be copied to this folder.
|-Used to store applications (generally, an application has a package structure. Copy the. Class file in the bin directory of the project together with the package)
4. Configure the wrapper. conf configuration file of the wrapper tool.
Configure the location of the Java Virtual Machine
Wrapper. java. Command = c: \ Program Files \ Java \ jdk1.6.0 _ 07 \ bin \ Java
Configure the main class of wrapper. If you use its proxy method, fill in org. tanukisoftware. wrapper. wrappersimpleapp
Wrapper. java. mainclass = org. tanukisoftware. wrapper. wrappersimpleapp
Tool to find the path of the jar package and Application
Wrapper. java. classpath.1 = ../lib/wrappertest. Jar
Wrapper. java. classpath.2 = ../lib/wrapper. Jar
Wrapper. java. classpath.3 = ../lib/wrapper. dll
The application and its folder are copied to the application folder, so you only need to specify the path to./application/
Wrapper. java. classpath.4 = ../application/
All jar packages used by the application
Wrapper. java. classpath.5 = ../application/lib/*. Jar
Wrapper. java. Library. path.1 = ../lib
Wrapper. java. additional.1 =-dprograme. Name = run. bat
To make an application a service, you need to write the Class Name of the main function here.
Wrapper. App. parameter.1 = com. Timeseries. myseries
Wrapper. Console. format = PM
Wrapper. Console. loglevel = info
Specify the location of the log record
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 = wrapper Application
Wrapper. ntservice. Name = @ wrapper @
Wrapper. ntservice. displayname = @ wrapperapplication @
Wrapper. ntservice. Description = @ wrapperdescription @
Wrapper. ntservice. dependency.1 =
Wrapper. ntservice. starttype = auto_start
Wrapper. ntservice. Interactive = false
5. Run cmd.
Cd c: \ myserverapp \ bin
App. Bat Test
Installation of InstallApp-NT.bat
UninstallApp-NT.bat uninstall installed services
| ************************************** ********************************* |
In the service, the program obtains the current path, not in the directory where the. Class or jar file is located, but in the bin directory.
This is important. Therefore, the configuration required by many programs must be placed in the bin directory, rather than under the directory that is put together with the program.

Related Article

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.