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. Nx32926 命令关机

    一. poweroff关机命令 ~ # poweroff ~ # baud=, quot= w-config: 8bits/char umount: devtmpfs busy - remounted ...

  2. hdu 5429 Geometric Progression(存个大数模板)

    Problem Description Determine whether a sequence is a Geometric progression or not. In mathematics, ...

  3. 重载operator new实现检测内存泄漏是否可行

    行与不行,就凭我这水平,说出来未免显示太过自大.不还,我还想根据自己的代码来讨论这个问题. 重载operator new来检测内存只的办法,那就是在new的时候记录指针地址及文件名.行号,在delet ...

  4. 动态规划之最长公共子序列LCS(Longest Common Subsequence)

    一.问题描述 由于最长公共子序列LCS是一个比较经典的问题,主要是采用动态规划(DP)算法去实现,理论方面的讲述也非常详尽,本文重点是程序的实现部分,所以理论方面的解释主要看这篇博客:http://b ...

  5. ie6下a标签的onclick事件不执行问题解决方案

    <a href="javascript:void(0)" onclick="loadiframe()">点我咯</a> <scri ...

  6. Html中value和name属性的作用

    1.按钮中用的value 指的是按钮上要显示的文本  比如“确定”“删除”等 2.复选框用的value 指的是这个复选框的值 3.单选框用的value 和复选框一样 4.下拉菜单用的value 是列表 ...

  7. 设置root远程连接ubuntu上mysql

    1.安装mysql,如果是root用户,直接执行一下命令.如果非root,则需要用sudo命令 a. apt-get install mysql-server b. apt-get isntall m ...

  8. 0..n去掉一个数,给你剩下的数,找出去掉的那个数

    转载请注明转自blog.csdn.net/souldak , 微博@evagle 首先,考虑没有去掉那些数,如果n是奇数,n+1个最低位肯定是0101...01,count(0)=count(1),如 ...

  9. JQuery 之事件中的 ----- hover 与 onmouseover 、onmouseout 联系

    hover([over,]out) 一个模仿悬停事件(鼠标移动到一个对象上面及移出这个对象)的方法.这是一个自定义的方法,它为频繁使用的任务提供了一种“保持在其中”的状态. 当鼠标移动到一个匹配的元素 ...

  10. XML读写

    private string fileName = HttpContext.Current.Server.MapPath("~/Student.xml"); protected v ...