How to run the application without being killed after logging out?

I have a Java application that should run on the server in the background (the application can be started by a command without a GUI). The problem is this: when I exit the server, the application will be killed. I am looking for something like this, for example nohup under Linux. I found some solutions, but I'm not sure which is better for my situation (Windows Server 2003, Java application starts from BAT-Script, reboots after the computer boots)? What are the advantages and disadvantages of solutions?

+4
source share
4 answers

Just to add to the answers above.

Consider using http://wrapper.tanukisoftware.com . It is quite mature and popular (unlike ServiceEx and RunAsService).

+1
source
  • Write a Windows service (in Java, C # - I don't think it matters)
  • Launch the application from your service.

or

+3
source

The only way you can start a process without logging in is to start the process as a Windows service, or at least call the Windows service.

+3
source

Yes, the Windows service is definitely suitable, but there are a few things to consider when starting a Java application as a Windows service. Most of them are described in this tutorial, which shows how to set up a Java application with our commercial all-as-in-application, AlwaysUp:

http://www.coretechnologies.com/products/AlwaysUp/Apps/RunJavaApplicationAsAService.html

Beware: you will almost certainly need the β€œ-Xrs” flag in Windows 2003 to prevent closing behavior on output, but things can get complicated if you catch shutdown events. Let me know if this is a problem for your situation.

0
source

Source: https://habr.com/ru/post/1386293/


All Articles