Passa ai contenuti principali

Post

Visualizzazione dei post con l'etichetta windows

Running Java Applications as a Windows Service with NSSM

Sometimes there is the request to run a Java Application as a windows service, for this scenario it is possible to use a java wrapper as NSSM. The example uses a java application that log on file the boot operation, the alive status every 10 seconds, and the exit operation. The code of the example can be downloaded with SVN from the repository https://subversion.assembla.com/svn/gma-sample/trunk/WindowsServiceTutorial. Java package org.gma.tutorial.nssm; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; import java.util.Date; /** * A Simple service to register as Windows Service, the program will log on a * file when it starts, ends and every 10 seconds it will log is alive state * * */ public class WindowsServiceTutorial { public static void main(String[] args) throws FileNotFoundException { /* Set the custom message to display */ String customMessage = "default"; if (args.leng…