Service type of application runs in background
Service type of application runs as a Service on Windows and Linux.
This type of generated exe cannot be excuted directly on Windows. If it is executed directly on Linux, it will go into daemon status. To run as a normal Service, you need to "/install" it first.
Install & Uninstall
You need to "/install" it first before Service type of generated exe can run as a Service. You need a Administrator privilege to install a service. For example:
YourProgram /install auto
The 'auto' is to let service automatically start up when System starts up.
Service Arguments [since 2.0.4]
From v2.0.4, the service type of application supports to add fixed arguments to programs, both Windows and Linux supported:
YourProgram /install auto arg1 arg2
After successful "/install", you can find the service in service manager, "services.msc" on Windows, "ntsysv" on Linux. The service program will keep running after user logs out. You can also control the service start and stop through command line. On Windows:
net stop YourServiceName
service YourProgram stop
Use "/uninstall" to uninstall the service from System. You'd better stop the service first before uninstall it.
About the ServiceName
For Service type on Windows, the ServiceName is specified during generating, see Step 3: Main Java Class page.
For Service type on Linux, the ServiceName is the Program file name.
For debug use, you can run your Service type of generated exe as Console type by a "/test" parameter.
The current working directory of Service type is set to the "applicaton.home" by default, where the exe file is. You can use a 'forcecwd' configure item to specify a new position with a relative path or absolute path.
- See forcecwd page for details of current working directory configuration.
By default, the System.err of Service type is redirect to a disk file. You can use a 'stderr' configure item to overwrite it.
- See stdout, stderr page for details of stdout redirection.