Java Service Wrapper

将Java 应用程序部署成Windows系统服务Java Service Wrapper 1

Product Overview 1

Editions 2

Methods of Integrating with the Java Service Wrapper 2

Method 1 - WrapperSimpleApp Integration (Windows) 2

Export your program as a runnable jar 2

Installing Wrapper Files 2

bin directory 2

lib directory 3

conf directory 3

logs directory 3

Modifying the "wrapper.conf" File 3

java executable 3

main class 3

classpath 3

library path 4

Additional Parameters 4

Initial Java Heap Size (in MB) 4

Maximum Java Heap Size (in MB) 4

application parameters 4

Trying It Out 4

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 并新建bin、lib、conf、logs四个子文件

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.in、InstallApp-NT.bat.in、UninstallApp-NT.bat.in以及bin目录下的wrapper.exe到D:\MyService\bin目录下。

重命名App.bat.in、InstallApp-NT.bat.in、UninstallApp-NT.bat.in为App.bat、InstallApp-NT.bat、UninstallApp-NT.bat。

lib directory

拷贝Java Service Wrapper解压文件中lib目录下的wrapper.jar和wrapper.dll到D:\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

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

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.bat将java应用程序部署成Windows系统服务。可进入控制版面-管理工具-服务,查看系统服务部署成功与否,并启动该服务。UninstallApp-NT.bat用于卸载该服务。

附录:

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

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

Java Service Wrapper的更多相关文章

  1. Java Service Wrapper简介与使用

    在实际开发过程中很多模块需要独立运行,他们并不会以web形式发布,传统的做法是将其压缩为jar包独立运行,这种形式简单易行也比较利于维护,但是一旦服务器重启或出现异常时,程序往往无法自行修复或重启.解 ...

  2. 使用 Java Service Wrapper 启动java后台进程服务

    Java Service Wrapper (http://wrapper.tanukisoftware.com/doc/english/product-overview.html)可以很方便得在各个平 ...

  3. java service wrapper 级别为info导致内存剧增直至溢出

    上周,公司某一环境发生java service wrapper内存剧增导致最后被自动killed的情况,经过分析,确定导致java service wrapper(后续简称wrapper)守护进程内存 ...

  4. 利用JAVA Service Wrapper把JAVA程序做成windows服务

    今天做了一个读取数据入库的程序.由于读取的数据每天都更新,于是就想把程序做成一个服务,每天定时执行.研究了一下,发现有几种方式可以做.下面我主要记录一下JAVA Service Wrapper方式. ...

  5. 利用Java Service Wrapper将java项目添加到windows服务中

    1.web项目,即tomcat/resin添加至window系统服务,步骤如下:第一步:找到tomcat的bin目录,如:D:\apache-tomcat-8.0.26\bin第二步:打开cmd,cd ...

  6. 使用Java Service Wrapper在Linux下配置Tomcat应用

    前言 Java Service Wrapper是Tanuki Software的一个产品,可以将Java应用注册成Windows或Linux服务,使其可以随系统开机启动,同时可以监控Java应用的状态 ...

  7. Java Service Wrapper 使用

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/sinat_26279177/article/details/70807173 1       简介 ...

  8. Java Service Wrapper将java程序设置为服务

    有时候我们希望我们java写的程序作为服务注册到系统中,Java Service Wrapper(下面简称wrapper)是目前较为流行的将Java程序部署成Windows服务的解决方案, 本文将讨论 ...

  9. java service wrapper日志参数设置及优化

    一般在容器比如tomcat/weblogic中运行时,我们都是通过log4j控制日志输出的,因为我们现在很多服务端使用java service wrapper(至于为什么使用jsw,原先是比较排斥使用 ...

随机推荐

  1. 事件处理原理(IOS篇) by sixleaves

    前言 了解IOS事件处理的本质关键要先掌握几个概念.首先是事件的派发(Event Delivery)的过程, 一个是响应者链条如何构成. 事件的派发: Q1: 你有没有想过,如果你一个屏幕中有多个的V ...

  2. SoftLayerDebug

  3. c++中可以对类中私有成员中的静态变量初始化吗?

    转载http://www.cnblogs.com/carbs/archive/2012/04/04/2431992.html 问题:我看的书上写的对私有部分的访问可以是公共部分的成员函数,也可以是友员 ...

  4. yum笔记

    rpm --> yum HTML: HyperText Mark LanguageXML: eXtended Mark Language XML, JSON: 半结构化的数据 yum仓库中的元数 ...

  5. 2D和3D空间中计算两点之间的距离

    自己在做游戏的忘记了Unity帮我们提供计算两点之间的距离,在百度搜索了下. 原来有一个公式自己就写了一个方法O(∩_∩)O~,到僵尸到达某一个点之后就向另一个奔跑过去 /// <summary ...

  6. python之路-随笔 python处理excel文件

    小罗问我怎么从excel中读取数据,然后我百了一番,做下记录 以下代码来源于:http://www.cnblogs.com/lhj588/archive/2012/01/06/2314181.html ...

  7. MyCat部署运行(Windows环境)与使用步骤详解

        目录(?)[+] 1.MyCat概念 1.1 总体架构 MyCAT的架构如下图所示: MyCAT使用MySQL的通讯协议模拟成一个MySQL服务器,并建立了完整的Schema(数据库).Tab ...

  8. HDU 1085 Holding Bin-Laden Captive! (母函数)

    Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Ja ...

  9. el表达式判断是否相等

    <c:if test="${order.baofang eq 0 }"> 无包间 </c:if> <c:if test="${order.b ...

  10. EffectiveC#02--仅在对基类进行强制更新时才使用new修饰符

    1.建议避免使用new修饰符来重新定义非虚函数. 非虚方法是静态绑定的,不管哪里的代码也不管在哪里引用, 它总是严格的调用类中所定义的函数.并不会在运行时在 派生类中查找不同的版本. 2.何时使用ne ...