简体   繁体   中英

Procrun monitor application for Java program

Anyone tried to run Java console or GUI application with Procrun as a Windows service?

If I normally use Java -jar chat.jar -n room1 how do I use on Procrun in the best way?

i have my java app (entry point is just public static void main(String[] args) ) working as a windows service with the code below

@prunsrv //IS//SMTPMan --DisplayName="SMTPMan Proxy" \
--Install="C:\devel\_Executables\SMTPManService\prunsrv.exe" \
--Startup auto --Jvm auto --StartMode jvm --StopMode jvm \
--StartClass eu.javaman.smtp.Service  --StartMethod main \
--StopClass eu.javaman.smtp.Service --StopMethod main \
--StopParams stop --Classpath C:\devel\_Executables\SMTPManService\SMTPMan.jar \
--LogPath C:\devel\_Executables\SMTPManService \
--Description "Smtp Proxy service by xxx" \
--StdOutput C:\devel\_Executables\SMTPManService\SMTPMan.log \
--StdError C:\devel\_Executables\SMTPManService\SMTPMan.log \
--Type interactive

there is some warning when stopping the service installed by the script above, but its no stopper so i dont mind :)

always use fully specified paths, also check http://commons.apache.org/daemon/procrun.html for your specific needs; but dont use '=' :)

if param value contains spaces wrap it in quotes
if the service is properly installed, you can easily use prunmgr.exe to start/stop (also modify all mentioned parameter values), this interface has two or three more tabs than the one accessible thru the services windows control

for spaces within path there is workaround found in another thread:

@rem #FOR %%F IN ("C:\Program Files\prunsrv.exe") DO SET prunsrv=%%~sF <br>
@rem #prunsrv … --Install=%prunsrv%

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM