If we run a java application, its process name would be java.exe. There may be multiple java.exe in a system, it's hard to distinguish them. Customer may kill our application by mistake. So we want our java application have a good meaningful name such as MyApp.exe.
One approach is to use executable wrapper like
Launch4j, WinRun4J, Janel, NSIS to creates native Windows launchers for java application.
Another approach described is to use Apache Procrun to run the java application as a windows service.
If we run java application in jvm mode, the default process name would be prunsrv.exe.
But we can easily give the process an meaningful name such as MyApp.exe. All we need do is rename prunsrv.exe to MyApp.exe: in install|start|stop|uninstall scripts, we replace every occurrence of prunsrv.exe to MyApp.exe.
set PRUNSRV=%~dp0%MyApp.exe
"%PRUNSRV%" //IS//%SERVICE_JAVA% --Install="%PRUNSRV%"
Compare with the first approach, running java application as a service allows us to make it start automatically when windows starts, easier to manage the service using sc start|stop|delete serviceName or net start|stop commands.
In task manager, we can see the process of our Java application is MyApp.exe:
Please read the full code from
Windows BAT: Using Apache Procrun to Install Java Application As Windows Service
One approach is to use executable wrapper like
Launch4j, WinRun4J, Janel, NSIS to creates native Windows launchers for java application.
Another approach described is to use Apache Procrun to run the java application as a windows service.
If we run java application in jvm mode, the default process name would be prunsrv.exe.
But we can easily give the process an meaningful name such as MyApp.exe. All we need do is rename prunsrv.exe to MyApp.exe: in install|start|stop|uninstall scripts, we replace every occurrence of prunsrv.exe to MyApp.exe.
set PRUNSRV=%~dp0%MyApp.exe
"%PRUNSRV%" //IS//%SERVICE_JAVA% --Install="%PRUNSRV%"
Compare with the first approach, running java application as a service allows us to make it start automatically when windows starts, easier to manage the service using sc start|stop|delete serviceName or net start|stop commands.
In task manager, we can see the process of our Java application is MyApp.exe:
Please read the full code from
Windows BAT: Using Apache Procrun to Install Java Application As Windows Service