Showing results for 
Show  only  | Search instead for 
Did you mean: 

This product reached the end of support date on March 31, 2021.

Environment variable -JVM commandline for Java agent


During a Java agent configuration , we set dynatrace command line argument to JVM as

"-agentpath:<DTHOME>\name=<Agent Name>,server=<collector:port>"

Can we configure DTHOME as a environment variable in server and set the environment variable to the above command line. Has anyone tried it ?

The purpose of this is , we are migrating agent from old version to new version . Setting this will help us not to make any mess in JVM in case of any future upgrades, we can change the DTHOME value in environment variable and proceed .


Dynatrace Pro
Dynatrace Pro

Hi Sruthi,

in general this will work, note however that it depends on the shell you're starting this from. If it's in a .bat or a .sh file or the actual command line, no problem, the shell will replace the variable.

If it's in some config/properties file and the java process gets started from some other executable, you'll have to make sure that environment variable replacement happens at some point yourself. Best regards,


PS: Also note that if there's a blank in the path, you need to be careful about where to put the quotation marks, depending on the shell in use this could be an issue.