Java as windows service with Apache Procrun and --add-module --add-opens --add-exports

836 Views Asked by At

We witched to Java11 and had to add

  • --add-module
  • --add-opens
  • --add-exports as JVM parameters

The java program is running as a windows service via Apache Procrun. Adding one of the above mentioned parameters to Java Parameters leads to a non starting service. If I remove these lines, the JVM comes up.

I already updated the procrunsvr and procrunmgr to the latest version. There are Java 9 Options. But even if I am adding here the above mentioned parameters the service comes not up and ends with

[2021-05-27 13:09:53] [error] ( javajni.c:828 ) [ 8948] CreateJavaVM Failed with error [-1]
[2021-05-27 13:09:53] [error] ( javajni.c:828 ) [ 8948] The system cannot find the file specified.
[2021-05-27 13:09:53] [debug] ( javajni.c:1087) [ 8948] Java worker thread finished : with status = 2
[2021-05-27 13:09:53] [error] ( prunsrv.c:1386) [ 8892] Failed to start Java
[2021-05-27 13:09:53] [error] ( prunsrv.c:1740) [ 8892] ServiceStart returned 4.
[2021-05-27 13:09:53] [debug] ( prunsrv.c:1032) [ 8892] reportServiceStatusE: dwCurrentState = 1, dwWin32ExitCode = 1066, dwWaitHint = 0, dwServiceSpecificExitCode = 4.
[2021-05-27 13:09:53] [info]  ( prunsrv.c:1808) [ 8536] Run service finished.
[2021-05-27 13:09:53] [info]  ( prunsrv.c:1980) [ 8536] Apache Commons Daemon procrun finished.

I have this JVM Params:

--add-modules java.se
--add-exports java.base/jdk.internal.ref=ALL-UNNAMED
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.nio=ALL-UNNAMED
--add-opens java.base/sun.nio.ch=ALL-UNNAMED
--add-opens java.management/sun.management=ALL-UNNAMED
--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED

How I can add Java 9 and above parameters to procrun?

Thanks to Nikolais hint I had to add the =sign.

--add-modules=java.se
--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.nio=ALL-UNNAMED
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
--add-opens=java.management/sun.management=ALL-UNNAMED
--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED
0

There are 0 best solutions below