22 Mart 2016 Salı

How to run Java console application as a Windows service?

I needed to run Java console application as a Windows service. When I googling, I found out two solution such as;

1) Java service wrapper such as Tanuki and YAJSW. It provides reaching the solution in a direct way. However, configuration in wrapping process is more difficult than the second solution.

2) It is a little long, but easy way. Instruction of second solution is indicated below;

  • Export Java console application project as a jar file. I used Eclipse as Java code editor that's why I made it easily.
  • Download Launch4j and convert the jar file to exe file. This program has user-friendly UI. Also, the tutorial video can be reached through this link.
  • Download NSSM - the Non-Sucking Service Manager and install the exe file as a Windows service. This link shows how to do it. Configuration is very easy, because of its GUI (Figure-1).

I use the second solution and the console application works properly as a Windows service in my computer.

Hiç yorum yok:

Yorum Gönder