Launching the printer agent as a service using Non-Sucking Service Manager (NSSM)

Note: Before running the print agent as a service, ensure that the nssm.exe is located in the printeragent folder. Use nssm.exe (win64) for 64bit and nssm.exe (win32) for 32bit.
  1. Open a command prompt and navigate to the folder where the printagent.jar file is located.
  2. Create Windows service by running in the command prompt this script:

    nssm.exe install "<SERVICE NAME>" "<JAVA_HOME_LOCATION>\bin\java.exe" "-Xmx64m" "-XX:-TieredCompilation"-jar <PRINT_AGENT_LOCATION>\printagent.jar -c <PRINT_AGENT_LOCATION>\<PROPERTIESFILE>"

    Note: Adjust the JVM size based on the expected volume of documents needed when running a print agent.

    Example:

    nssm.exe install "MSCM print agent" "C:\Java\jdk1.8.0_171\bin\java.exe" "-Xmx64m" "-XX:-TieredCompilation" -jar C:\printagent\printagent.jar -c C:\printagent\printagent-demo.properties"

    Note: To delete a service, run this script in the command prompt:

    nssm remove "<SERVICE NAME>"

  3. Set the application directory by running in the command prompt this script:

    nssm.exe set "<SERVICE NAME>" AppDirectory "<PRINT_AGENT_LOCATION>"

    Example:

    nssm.exe set "MSCM Print Agent" AppDirectory "C:\printagent"

  4. Start the service by running this script in the command prompt:

    nssm start "<SERVICE NAME>"

    Note: To validate if printer agent is running as a service, specify services.msc in the command prompt and locate the created service if it is running.