How to create a windows service from java app

前端 未结 19 1929
既然无缘
既然无缘 2020-11-22 04:09

I\'ve just inherited a java application that needs to be installed as a service on XP and vista. It\'s been about 8 years since I\'ve used windows in any form and I\'ve neve

19条回答
  •  情深已故
    2020-11-22 05:03

    With Java 8 we can handle this scenario without any external tools. javapackager tool coming with java 8 provides an option to create self contained application bundles:

    -native type Generate self-contained application bundles (if possible). Use the -B option to provide arguments to the bundlers being used. If type is specified, then only a bundle of this type is created. If no type is specified, all is used.

    The following values are valid for type:

    -native type
    Generate self-contained application bundles (if possible). Use the -B option to provide arguments to the bundlers being used. If type is specified, then only a bundle of this type is created. If no type is specified, all is used.
    
    The following values are valid for type:
    
    all: Runs all of the installers for the platform on which it is running, and creates a disk image for the application. This value is used if type is not specified.
    installer: Runs all of the installers for the platform on which it is running.
    image: Creates a disk image for the application. On OS X, the image is the .app file. On Linux, the image is the directory that gets installed.
    dmg: Generates a DMG file for OS X.
    pkg: Generates a .pkg package for OS X.
    mac.appStore: Generates a package for the Mac App Store.
    rpm: Generates an RPM package for Linux.
    deb: Generates a Debian package for Linux.
    

    In case of windows refer the following doc we can create msi or exe as needed.

    exe: Generates a Windows .exe package.
    msi: Generates a Windows Installer package.
    

提交回复
热议问题