batch file - Run .bat as a Windows Service -



batch file - Run .bat as a Windows Service -

i'm here 1 time again case getting me out mind.

so, happening, i'm trying run executable java class(.jar) windows service, , attempts failed far. create little easier, turned jar batch file, wich executes jar in background, here code:

start "" javaw -jar c:\localservice.jar

the batch works fine. have tried install batch service using next line in cmd:

sc create "localservice" binpath= "c:\localservice.bat"

the service installs correctly, seek start it, pops error (the code error 1053, says service did not start correctly)

also, have seek software called nssm (non-sucking service manager) installs fine too, service not start either.

do guys know missing?

by way, i'm doing on windows 7 professional.

thanks!

thanks comments both tools didnt work me, sadly. able software called java service wrapper. not free software, needed purchase license work. steps simple:

1.-create folder name of service, within add together 4 folders: lib,bin,logs,conf

2.-on lib folder have re-create jar , wrapper.jar , wrapper.dll (these lastly 2 in zip download website)

3.-copy 4 files bin folder: installapp-nt.bat.in, app.bat.in, unintstallapp-nt.bat.in , wrapper.exe (this lastly 1 1 defines license, if can file wrapper.exe else had paid license work fine. these file came in zip website) remove .in batch files

4.-the tricky step this: have re-create wrapper's folder called conf file called wrapper.conf.in remove .in extension , edit tex editor. of import lines have edit are:

wrapper.java.command=c:\program files (x86)\java\jre7\bin\java //specify jre path. work eviroment variable wrapper.java.mainclass=org.tanukisoftware.wrapper.wrapperjarapp //choosing class means using .jar file execute when service starts wrapper.java.classpath.1=c:\localservice\lib\wrapper.jar //this 1 constant. wrapper.java.classpath.2=c:\localservice\lib\localservice.jar //this path executable jar wrapper.java.library.path.1=c:\localservice\lib //path own lib folder (the created @ begining) wrapper.app.parameter.1=c:\localservice\lib\localservice.jar // 1 time again path jar

then execute installapp-nt.bat , start service , done

it worked me absolute paths, according documentation work fine relative path too. how solved problem , hope same issue find helpful

see next time!

batch-file service jar

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -