Java default JRE parameters on Unix
Is it possible to configure java in unix to always add a JRE parameter whenever java is run?
e.g. -Dcom.sun.management.jmxremote.port=25800
You can create a wrapper script and add it to your path. Something like this
#!/bin/bash
java -Dcom.sun.management.jmxremote.port=25800 "$@"
Call it java-local.sh or some other fancy name and just use it in place of the java
binary. Of course this one is pretty basic but I am sure it caters for like 90% of the cases. As a shell exercise, you could make it an alias for your user (but then it only works for your user):
# alias java='java -Dcom.sun.management.jmxremote.port=25800'
IBM java has support for a SystemDefault.properties
file, where each line specifies one Java system property or command line option. but I can't see anything similar for the oracle JDK, and there is a similar thread gone unanswered here;
https://forums.oracle.com/forums/thread.jspa?threadID=2131751
stracing openjdk during startup, seems to indicate that it does not look for any ".properties" files, so I am guessing that the answer is no. But there might be a Java expert come along with a better answer.