jvm arguments - Is it possible to "fool" java that an environment variable is set from the command line -


i'm running in environment can pass parameters not set environment variables using normal commandline.

i set environment variables nevertheless. there alternative way "fool" java environment variable set, e.g. using -d parameters?

(i'm running spark in oozie through hue; in cloudera stack).

the java command doesn't seem allow that. has -d parameter, sets java 'system properties':

$ java -help 2>&1 | grep -a1 '\-d'      -d<name>=<value>                   set system property 

java system properties sort of java properties. environment variables, java properties key-value pairs, aren't same thing environment variables: if java application reacts specific environment variable, setting system property of same name won't have effect unless application explicitly reacts property, too.

if environment allows run arbitrary java applications , if allows java applications execute other processes, can write little wrapper sets environment variables on processbuilder (see question arnon linked in his comment: how set environment variables java?) invoke java actual jar it. either hard-code environment variables set, or set them according system properties wrapper receives. (or implement own shell in java , pass script it.)

though, if can modify source of actual jar, more idiomatic solution make react properties instead of (or additionally to) environment variables. (unless have control environment variables java command / jvm reacts rather jar you'd run. approach not applicable, of course.)


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -