How to create a windows service from java app

前端 未结 19 2275
既然无缘
既然无缘 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 04:48

    it's simple as you have to put shortcut in

    Windows 7 C:\users\All Users\Start Menu\Programs\Startup(Admin) or User home directory(%userProfile%)

    Windows 10 : In Run shell:startup

    in it's property -> shortcut -> target - > java.exe -jar D:\..\runJar.jar

    NOTE: This will run only after you login


    With Admin Right

    sc create serviceName binpath= "java.exe -jar D:\..\runJar.jar" Will create windows service

    if you get timeout use cmd /c D:\JAVA7~1\jdk1.7.0_51\bin\java.exe -jar d:\jenkins\jenkins.war but even with this you'll get timeout but in background java.exe will be started. Check in task manager

    NOTE: This will run at windows logon start-up(before sign-in, Based on service 'Startup Type')

    Detailed explanation of creating windows service

提交回复
热议问题