How to pass a system property using Wrapper.exe

How to pass a property to a Java process running as a Windows service using Wrapper.exe?

The target code calls:

System.getProperty("ADMIN_USERNAME");
+7
source share
4 answers

http://wrapper.tanukisoftware.org/doc/english/prop-java-additional-n.html

You can set "extra parameters" that will be passed to the JVM (unlike your main class), and -DADMIN_USERNAME = gandalf should work there.

wrapper.java.additional.1=-Xrs
wrapper.java.additional.2=-Dprop=TRUE
wrapper.java.additional.3=-DADMIN_USERNAME=gandalf

Update: you should start with extra.1 and count without spaces (this is the convention for lists in the Java property syntax).

+7
source
0

, , JMX ? , ?

Yuval = 8 -)

0

@ Tilo the answer is correct, but I feel like I should add that you have to take care of the JAVA_OPTS environment variable . Many people / servers tend to use it (e.g., remote debugging), because everything you put in JAVA_OPTS is passed as JVM arguments to any new JVM. If you have set this environment variable, then any wrapper.java.additional.<n> will be ignored . I found this on my way :)

0
source

Source: https://habr.com/ru/post/1704424/


All Articles