Take the 2-minute tour ×

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

share|improve this question
add comment

3 Answers

You can create a wrapper script and add it to your path. Something like this


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'
share|improve this answer
+1 Recommend double-quoting $@ to preserve arguments in the face of whitespace. (Sorry, I'd have edited that in myself, but I have repeatedly, comically, and miserably failed the CAPTCHA.) –  pilcrow Aug 18 '12 at 15:02
add comment

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;

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.

share|improve this answer
add comment

You could create an alias

alias java='java -Dcom.sun.management.jmxremote.port=25800'

You could also play around with Application Resource Files which may be more appropriate.

share|improve this answer
add comment

Your Answer


