windows註冊服務

下載Windows Service Wrapper


1. github下載winswjava

Winsw

安裝windows服務

  1. 2. 將java jar包和下載的WinSW.NET4.exe放在同一個文件夾目錄下面git

  2.    重命名WinSW.NET4.exe爲MyApp.exe(這個能夠任意取),新建個MyApp.xml(這個必須和前者的exe文件名字相同)github

  3.   MyApp

3. 編輯MyApp.xml文件windows

<configuration>
    <id>MyApp</id>
    <name>MyApp</name>
    <description>This is MyApp.</description>
    
    <executable>java</executable>
    <arguments>-jar C:\Users\tanhw119214\Desktop\MyApp\MyApp.jar</arguments>
      <!-- 開機啓動 -->
     <startmode>Automatic</startmode>
    <logpath>C:\Users\tanhw119214\Desktop\MyApp\logs</logpath>
    <log mode="roll-by-time">
    <pattern>yyyyMMdd</pattern>
    </log>
</configuration>
C:\Users\tanhw119214\Desktop\MyApp 爲你要要註冊服務的文件的父路徑


4.進入根目錄下面,執行如下cmd命令,註冊服務。而後在服務裏面就能找到這個實例了。bash

  • 啓動命令app

net start MyApp1
  • 中止命令ide

net stop MyApp1
  • 卸載命令spa

sc delete MyApp
相關文章
相關標籤/搜索