From: Mathieu Desnoyers Date: Wed, 11 May 2016 00:37:36 +0000 (-0400) Subject: Fix: Java agent should use LTTNG_HOME X-Git-Tag: v2.7.4~4 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=11eeb23eff5b7f2c6a196b92a416f7597f5c63ec;p=lttng-ust.git Fix: Java agent should use LTTNG_HOME Both in UST C/C++ support and Python agent, LTTNG_HOME can be used to override HOME for lttng-ust. Ensure the Java agent has the same behavior. Fixes: #881 Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java b/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java index d376f672..e2494923 100644 --- a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java +++ b/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java @@ -245,7 +245,16 @@ class LTTngTCPSessiondClient implements Runnable { } private static String getHomePath() { - return System.getProperty("user.home"); + /* + * The environment variable LTTNG_HOME overrides HOME if + * defined. + */ + String homePath = System.getenv("LTTNG_HOME"); + + if (homePath == null) { + homePath = System.getProperty("user.home"); + } + return homePath; } /**