github下載java
3.編輯MyApp.xml文件git
<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 爲你要要註冊服務的文件的父路徑github
4.進入根目錄下面,執行如下cmd命令,註冊服務。windows
MyApp.exe install
而後在服務裏面就能找到這個實例了。app
啓動命令
net start MyApp
中止命令
net stop MyApp
卸載命令
sc delete MyAppspa
將命令寫入到.bat文件,經過雙擊bat文件就能夠啓動項目3d
把這個命令寫到.bat文件中,用管理員來執行這個bat文件code
test.bat文件寫好了,以管理員身份運行這個文件xml
ok,服務建立成功了,取任務管理器看blog