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. Android核心基础(十)

    1.音频采集 你可以使用手机进行现场录音,实现步骤如下: 第一步:在功能清单文件AndroidManifest.xml中添加音频刻录权限: <uses-permission android:na ...

  2. jsp判断session中的值

    方法有两种: 假设,此session的名字叫adminAccount 1.EL表达式 <script type="text/javascript"> if($.trim ...

  3. Dave(正方形能围成的最大点数)

    Dave Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others)Total Submis ...

  4. android面试题之四

    十六.Android中Dalvik和JVM的区别是什么? 1. Dalvik基于寄存器,而JVM基于栈.基于寄存器的虚拟机对于更大的程序来说,在它们编译的时候,花费的时间更短. 2. Dalvik负责 ...

  5. [每日一题] 11gOCP 1z0-052 :2013-09-4 block header grows............................................A33

    转载请注明出处:http://write.blog.csdn.net/postedit/11100311 正确答案是:AD 要理解这道题就要去了解数据块的结构.引用OCPPPT中的一幅图: 从这幅图中 ...

  6. 该如何关闭thinkphp的缓存呢?有下面几种方法可参考:

    该如何关闭thinkphp的缓存呢?有下面几种方法可参考: (1)在配置文件中关闭缓存 在你的配置文件config.php文件中加上如下两句:   复制代码代码如下: 'TMPL_CACHE_ON'  ...

  7. HTTP协议4之缓存--转

    HTTP协议提供了非常强大的缓存机制, 了解这些缓存机制,对提高网站的性能非常有帮助. 缓存的概念 缓存这个东西真的是无处不在, 有浏览器端的缓存, 有服务器端的缓存,有代理服务器的缓存, 有ASP. ...

  8. html5 拖放---(二)转

    draggable是一个枚举属性,用于指定一个标签是否可以被拖拽.有以下四种取值: true 表示此元素可拖拽 false 表示此元素不可拖拽 auto 除img和带href的标签a标签表示可拖拽外, ...

  9. Android-----输入法的显示和隐藏

    /** * 控制手机虚拟键盘的显示和隐藏 */public class InputMethodUtil { /** * 隐藏虚拟键盘 * @param v  参数v为获取焦点对象view */ pub ...

  10. 使用Apache JMeter进行SQL优化性能测试

    一. 前言 最近在公司里做性能测试,对于一张大概400万数据的表,进行全表扫描往往会比较费时,更不要说有若干这样的表格级联进行检索了.为了能够在不影响生产环境的前提下进行SQL的性能优化,需要首先利用 ...