Introduction and use of Java Service Wrapper

Source: Internet
Author: User

Wrapper can be Java application programming a system server, very useful!

Have done before, but the company can not blog park, so this way to go down to do next record!

1. Download the Java Service Wrapper

URL: http://sourceforge.net/projects/wrapper/or http://wrapper.tanukisoftware.com/doc/english/download.jsp

The version I downloaded is wrapper-windows-x86-32-3.5.20.zip.

2. Configuration process

1) First make sure that you have a Java operating environment on your computer and install it if you don't have one.

2) Package your Java program into a jar package. (The name of my jar is the class of the Javaservicetest.jar,main method Javaservicetest)

3) Create a folder on the hard disk test, and under it create Folder Bin, Conf, Lib, logs.

4) Unzip the Wrapper-windows-x86-32-3.5.20.zip, and put its bin directory under the Wrapper.exe, Src/bin directory App.bat.in, Installapp-nt.bat.in, uninstallapp-nt.bat.in file

Copy to test's Bin directory and rename to App.bat, Installapp-nt.bat, Uninstallapp-nt.bat, respectively.

5) Copy the Wrapper.DLL and Wrapper.jar in its Lib directory to the Lib directory of test. and copy the jar of the project and the jar you are using to that directory (including your own Java program jar).

6) Copy the wrapper.conf.in in its src/conf directory to the Conf directory of Workapp and name it wrapper.conf.

3. Modify the Wrapper.conf file

The following items are mainly modified:

(1) JVM location:

Wrapper.java.command=c:\jdk1.5.0_07\bin\java or Wrapper.java.command=%java_home%/bin/java (needs to be configured in the system's environment variables Java_ HOME)
(2) MAIN CLASS here determines how Java service wrapper is used
Wrapper.java.mainclass=org.tanukisoftware.wrapper.wrappersimpleapp
(3) All the jar packages required for your Java program must be marked here, and note that the path is accurate:
wrapper.java.classpath.1=. /lib/javaservicetest.jar
Wrapper.java.classpath.2=. /lib/wrapper.jar
wrapper.java.classpath.3=. /lib/sqljdbc4.jar

......

(4) The directory where your Wrapper.DLL or Wrapper.jar are located
wrapper.java.library.path.1=. /lib
(5) Run class for your Java application (main class)
Wrapper.app.parameter.1=com.test.javaservicetest
(6) Register as the name and display name of the service, you can set it freely
Wrapper.name=testwrapper
Wrapper.displayname= Test Wrapper Sample Application
(7) Service Description information
wrapper.description= Test Wrapper Sample Application Description

(8) Startup type of the service

# Mode in which the service is installed. Auto_start, Delay_start or Demand_start
Wrapper.ntservice.starttype=auto_start

4. After the modification, run Myapp.bat to run your Java program, here you can test the configuration is correct, if you can run, prove the configuration OK.

5. Run Installapp-nt.bat to register the service and Uninstallapp-nt.bat for the logoff service.

6. After running the registration service Installapp-nt.bat can see your registered service name in the control Panel-hypervisor-service. (Example: Test Wrapper Sample application)


7, the service display process named Wrapper.exe, if you modify the program name, you need to modify the corresponding bat script in the statement!!

Reprinted from: http://blog.csdn.net/coolcoffee168/article/details/9980009

Introduction and use of Java Service Wrapper

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.