HowTo: How to check if my application was launched as a Windows Service

Compatibility :1.0.0
Editions :Professional EditionStandard EditionCommunity Edition
Platforms :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/Linux

Some applications will want to implement slightly different behavior when running as Windows Service (or UNIX Daemon), versus when running from a command prompt or console window. The Wrapper makes this easy to test for using the Wrapper's Java API.

Running as a service query example:
// Required imports:
import org.tanukisoftware.wrapper.WrapperManager;

// Code:
if ( WrapperManager.isLaunchedAsService() )
{
    // Application was launched as a Windows service or UNIX daemon.
}
else
{
    // Application is running in a command prompt or console.
}

Please see the Javadocs for more information.