Currently, I am trying to pass a system property to an executable in the following format: ./executable -Dvar="value" other parameters
, since this is what I've seen people do for java files. I keep getting an error in the executable saying that -Dvar="value"
doesn't exist as a parameter. Where am I going wrong? Are system properties exclusive to Java or something?
Asked
Active
Viewed 681 times
0

iHowell
- 2,263
- 1
- 25
- 49
1 Answers
0
The -D
parameter sets a system property. The system properties can be accessed through System.getProperty("<your parametername>");
A tutorial is given here https://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html
The -D
is consumed by the java runtime (java.exe
) and will be invisible to your application on the commandline.

thst
- 4,592
- 1
- 26
- 40
-
Ok, but how do I then add the system property when using an executable that uses java, not a jar? – iHowell May 26 '16 at 12:30
-
same, but instead of -jar, you call the class. You should consider reading the documentation on how to run java applications. – thst May 27 '16 at 05:43