How to install a Java application as a service

坚强是说给别人听的谎言 提交于 2019-12-24 09:57:24

问题


I have a Java Application written that forwards selected files to an ssh server. I want this application to be automatically run every time windows starts.

I am aware that this question has been asked multiple times, and I have followed those leads. I have tried Java Service Wrapper (which is no longer accessible because of a dns problem), Apache Daemon, and JSL. Though I have at times been able to get the application installed as a service, I have never been able to get it to run properly on boot, or even start it manually from the command line.

My question is whether anyone is aware of a full first step through final step tutorial of how to make this work. I have come across a few things, but they all either assume that you have implemented something that they do not explain how to implement, or rely on applications that I do not have installed.

Thanks


回答1:


I use Java Service Wrapper to install as windows or linux service: http://wrapper.tanukisoftware.com/doc/english/download.jsp

~> create one runnable JAR to your app.

~> Download the proper service wrapper (they are diffrent to windows and linux)

~> Configure the service in wrapper.conf

Important: set wrapper.java.classpath correct (your jar must be here too) Set wrapper.java.mainclass with org.tanukisoftware.wrapper.WrapperSimpleApp
Set wrapper.app.parameter.1 with the name of your main class, for example:

wrapper.app.parameter.1=Main

~> Test the service as console (windows bat)



来源:https://stackoverflow.com/questions/7352291/how-to-install-a-java-application-as-a-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!