Java as windows service?

Good time of day!

The challenge is how to run jar as a windows service. For this use prunsrv.exe from Apache (commons.apache.org/proper/commons-daemon/procrun.html). The problem is that when using the Java mode I encounter the problem "the data Area passed to a system call is too small." Help to understand what exactly the problem is and fix it.

Here are the options passed in prunsrv.exe

set OPTIONS=--JvmOptions=-Xss4M;-Xmx512M;-Xms256M;-Dbasedir="%HOME%";-Dapp.home="%HOME%";-Dapp.name="jService";-Dsun.net.inetaddr.ttl=90;-XX:+HeapDumpOnOutOfMemoryError;-XX:HeapDumpPath="%JSERVICE_HEAP_LOG%" ^
--StartMode=Java --StartClass=com.inet.jservice.WebSocketCryptographyDaemonController --StartParams="start" --StartMethod=main --stopmode setting=Java --StopClass=com.inet.jservice.WebSocketCryptographyDaemonController --StopParams="stop" --StopMethod=main ^
--LogPath="%LOG_HOME%" --PidFile="%PID_FILE%" --StdOutput="%PRUNOUT_LOG%" --StdError="%PRUNERR_LOG%" --LogLevel=Debug ^
--Startup=auto --Classpath="%JSERVICE_PATH%" --Description="123"

Then

".\prunsrv.exe" //IS//"jService" %OPTIONS%
".\prunsrv.exe" //ES//"jService"

Logs prunsrv

[2016-05-02 10:11:03] [debug] ( prunsrv.c:1679) [ 4328] Commons Daemon procrun log initialized
[2016-05-02 10:11:03] [info] ( prunsrv.c:1683) [ 4328] Commons Daemon procrun (1.0.15.0 32-bit) started
[2016-05-02 10:11:03] [debug] ( prunsrv.c:561 ) [ 4328] Installing service...
[2016-05-02 10:11:03] [info] ( prunsrv.c:600 ) [ 4328] Service jService name
[2016-05-02 10:11:03] [debug] ( prunsrv.c:616 ) [ 4328] Setting service description Cryptography web socket service,Inet Company Ltd.,2016
[2016-05-02 10:11:03] [info] ( prunsrv.c:634 ) [ 4328] Service 'jService' installed
[2016-05-02 10:11:03] [info] ( prunsrv.c:1764) [ 4328] Commons Daemon procrun finished
[2016-05-02 10:11:03] [debug] ( prunsrv.c:1679) [ 6580] Commons Daemon procrun log initialized
[2016-05-02 10:11:03] [info] ( prunsrv.c:1683) [ 6580] Commons Daemon procrun (1.0.15.0 32-bit) started
[2016-05-02 10:11:03] [info] ( prunsrv.c:725 ) [ 6580] Starting service 'jService' ...
[2016-05-02 10:11:03] [debug] ( prunsrv.c:1679) [ 2916] Commons Daemon procrun log initialized
[2016-05-02 10:11:03] [info] ( prunsrv.c:1683) [ 2916] Commons Daemon procrun (1.0.15.0 32-bit) started
[2016-05-02 10:11:03] [info] ( prunsrv.c:1596) [ 2916] Running 'jService' Service...
[2016-05-02 10:11:03] [debug] ( prunsrv.c:1374) [ 2572] Inside ServiceMain...
[2016-05-02 10:11:03] [debug] ( prunsrv.c:844 ) [ 2572] reportServiceStatusE: 2, 0, 3000, 0
[2016-05-02 10:11:03] [info] ( prunsrv.c:1127) [ 2572] Starting service...
[2016-05-02 10:11:05] [error] ( prunsrv.c:746 ) [ 6580] Failed to start 'jService' service
[2016-05-02 10:11:05] [error] ( prunsrv.c:746 ) [ 6580] the data Area passed to a system call is too small.
[2016-05-02 10:11:05] [info] ( prunsrv.c:754 ) [ 6580] Start service finished.
[2016-05-02 10:11:05] [error] ( prunsrv.c:1755) [ 6580] Commons Daemon procrun failed with exit value: 5 (Failed to start service)
[2016-05-02 10:11:05] [error] ( prunsrv.c:1755) [ 6580] the data Area passed to a system call is too small.

Not passed any parameters prunsrv.exe? Used not the JRE? Or need the JDK?
July 12th 19 at 16:35
1 answer
July 12th 19 at 16:37
Run the file with SYSTEM privileges (on Windows) on Linux Oh just run through sudo or root.
You can create sh/bat script that will do all the work for you.

Find more questions by tags ApacheJavaWindows