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 运行模式

    1, IOS下的 NSTimer与Run loop Modes http://blog.csdn.net/yuquan0821/article/details/16843195

  2. operator模块

    # -*- coding: utf-8 -*- # ==================== #File: python #Author: python #Date: 2014 #========== ...

  3. [最新版]MJRefresh解析与详细使用指导

    俗话说 "工欲善其事,必先利其器",好的成熟的第三方,是我们开发路上的利器:俗话又说"君子生非异也,善假于物也"NB的人并不是生下来就和别人不一样,只是他们擅于 ...

  4. request.getRequestURI()与request.getRequestURL()

    request.getRequestURL() 获得 http://www.quanqiuyouhui.com/ds-api-test/authorization/test.do request.ge ...

  5. linux磁盘管理、新增磁盘、分区、挂载

    1. du -sh 查看目录.文件总大小 -a:全部文件与目录大小都列出来.如果不加任何选项和参数只列出目录(包含子目录)大小. -c:最后加总2. df -h 查看磁盘使用量3. lsblk 查看系 ...

  6. for-in用法

    var nyc = {     fullName: "New York City",     mayor: "Bill de Blasio",     popu ...

  7. 关于scrollTop

    如下图

  8. solr热身

    入博客园快满一年,居然没写一篇博客,好惭愧. 公司的搜索系统需要从Lucene.net(更新相当不给力)换成solr了,最近一直在学习solr,相关资料是相当的少啊,特别是还要在.net环境下开发.准 ...

  9. FOR UPDATE SKIP LOCKED

    SYS_UNIT 中有UNIT_ID 0000000001 0000000002 0000001100 原意为若启用多线程,则每个线程在获取时仅可以获取一条数据(互斥) 脚本如下 1.SELECT * ...

  10. hdu 1085 Holding Bin-Laden Captive!

    Problem Description We all know that Bin-Laden is a notorious terrorist, and he has disappeared for ...