Java Service Wrapper

Java Service Wrapper 

Product Overview

The Java Service Wrapper enables a Java Application to be run as a Windows Service or UNIX Daemon. It also monitors the health of your Application and JVM.Please select the specific download for the platform and edition which meets your needs. All editions of the Wrapper can be downloaded freely. The Standard and Professional editions require that a valid license be present in the configuration file to run.

Editions

The Java Service Wrapper comes in three editions.

· Professional Edition - Includes all basic and advanced features.

· Standard Edition - Includes all basic and some advanced features.

· Community Edition - Includes all basic features.

Methods of Integrating with the Java Service Wrapper

There are currently four ways which a Java application can integrate with the Java Service Wrapper. Three of which will work out of the box without any additional coding.

The first step is to decide which of these four methods is best for your application. After a brief overview of each of the four options, we will go into detail how to integrate an application using each.

· Integration Method 1 (WrapperSimpleApp)

· Integration Method 2 (WrapperStartStopApp)

· Integration Method 3 (WrapperListener)

· Integration Method 4 (WrapperJarApp)

Method 1 - WrapperSimpleApp Integration (Windows)

建立新文件夹D\MyService 并新建binlibconflogs四个子文件

Export your program as a runnable jar

将你的项目以runnable jar file必须以此形式导出)的形式导出(命名为A.jar)

Installing Wrapper Files

根据你的操作系统平台以及操作系统类型下载合适的Java Service Wrapper版本 ,链接地址:http://wrapper.tanukisoftware.com/doc/english/download.jsp ,解压到任意目录。

bin directory

拷贝Java Service Wrapper解压文件中src\bin目录下的App.bat.inInstallApp-NT.bat.inUninstallApp-NT.bat.in以及bin目录下的wrapper.exeD\MyService\bin目录下。

重命名App.bat.inInstallApp-NT.bat.inUninstallApp-NT.bat.inApp.batInstallApp-NT.batUninstallApp-NT.bat

lib directory

拷贝Java Service Wrapper解压文件中lib目录下的wrapper.jarwrapper.dllD\MyService\lib

拷贝工程A.jar到D\MyService\lib

添加工程A依赖的第三方包到D\MyService\lib

conf directory

拷贝Java Service Wrapper解压文件中conf 目录下的wrapper.conf 到D\MyService\conf

logs directory

拷贝Java Service Wrapper解压文件中conf 目录下的wrapper 到D\MyService\logs

 

Modifying the "wrapper.conf" File

java executable

下载和安装java sdk,并设置环境变量(计算机-属性-高级系统设置-高级-环境变量):

在系统变量中设置:

变量名:JAVA_HOME

变量值:D:\Program Files\Java\jdk1.7.0_21

变量名:CLASSPATH

变量值:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar

 

wrapper.java.command=%JAVA_HOME%/bin/java 

main class

wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

classpath

wrapper.java.classpath.1=../lib/A.jar

wrapper.java.classpath.2=../lib/wrapper.jar

添加其他项目所需的第三方包

library path

wrapper.java.library.path.1=../lib

Additional Parameters

wrapper.java.additional.1=-Dprogram.name=App.bat

Initial Java Heap Size (in MB)

wrapper.java.initmemory=128

Maximum Java Heap Size (in MB)

wrapper.java.maxmemory=512

application parameters

wrapper.app.parameter.1=B(the main class in A.jar)

Trying It Out

完成以上步骤后,即可点击bin\App.bat,若未出现错误提示,则表明配置成功。即可点击bin\InstallApp-NT.batjava应用程序部署成Windows系统服务。可进入控制版面-管理工具-服务,查看系统服务部署成功与否,并启动该服务。UninstallApp-NT.bat用于卸载该服务。

 

 

 

 

附录:

另附一个java写的服务器工程(MapUpdateS)用于实践以及部署好Windows服务文件(MyService)。

使用前可修改MapUpdateSmapupdates.class下的IP地址为你本机地址(0.0.0.0,然后导出jar文件MapUpdates.jarMyService\lib目录.成功启动系统服务后,可在浏览器地址栏输入 0.0.0.0:8083以及http://0.0.0.0:8082/cache?wsdl查看服务是否正常工作。

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值