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.6.7~4 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=364e7df4d76c881a4d0e0046371ff086e20f13e4;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 76e8426b..78dae5e5 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 @@ -262,7 +262,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; } /**