<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: [resolved] How to get an environment variable from the system into a context var? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334412#M103085</link>
    <description>You can simply use System.getenv("myvar") in java, without an external code.&lt;BR /&gt;bye</description>
    <pubDate>Sun, 22 Nov 2009 17:22:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-11-22T17:22:08Z</dc:date>
    <item>
      <title>[resolved] How to get an environment variable from the system into a context var?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334405#M103078</link>
      <description>I am looking to implement the following scenario:
&lt;BR /&gt;Setup a system environment variable on the server that Talend is running on. The value of this variable will be a path to a folder containing XML files that I use for various purposes. At runtime in my job, I would like to use some Talend component to retreive the value of the environment variable and store it in a context variable. I can then use that context variable as the leading source string for my tXMLInput.
&lt;BR /&gt;I see a tSetEnv, but I do not see a tGetEnv comnponent.
&lt;BR /&gt;Any easy way to do this?
&lt;BR /&gt;thanks,
&lt;BR /&gt;Dave</description>
      <pubDate>Sat, 16 Nov 2024 13:44:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334405#M103078</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T13:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to get an environment variable from the system into a context var?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334406#M103079</link>
      <description>Hi;&lt;BR /&gt;To retrieve your environment variable use the following into a tJava (begin of your Job) like this : context.MyPath = System.getProperty("SYSTEM_ENV");&lt;BR /&gt;Best regards;</description>
      <pubDate>Wed, 07 Oct 2009 14:38:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334406#M103079</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-10-07T14:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to get an environment variable from the system into a context var?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334407#M103080</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;Hi;&lt;BR /&gt;To retrieve your environment variable use the following into a tJava (begin of your Job) like this : context.MyPath = System.getProperty("SYSTEM_ENV");&lt;BR /&gt;Best regards;&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Thanks! Sounds like tSetEnv needs a brother (tGetEnv) 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;Dave</description>
      <pubDate>Wed, 07 Oct 2009 18:07:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334407#M103080</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-10-07T18:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to get an environment variable from the system into a context var?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334408#M103081</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;Hi;&lt;BR /&gt;To retrieve your environment variable use the following into a tJava (begin of your Job) like this : context.MyPath = System.getProperty("SYSTEM_ENV");&lt;BR /&gt;Best regards;&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Thanks! Sounds like tSetEnv needs a brother (tGetEnv) 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;Dave 
&lt;BR /&gt;In the following code, the commented out line works, but sun java documentation says that getenv is deprecated. The uncommented line (getProperty) only works when I query for java.xxx properties (ex: java.io.tmpdir), but returns null when I use system environment vars. System.getProperty() is a java function. 
&lt;BR /&gt; 
&lt;BR /&gt;Also, I assume that this same command can be used against linux? 
&lt;BR /&gt; 
&lt;BR /&gt;context.CCRHome = System.getProperty("CCR_HOME"); 
&lt;BR /&gt;//context.CCRHome = System.getenv("CCR_HOME"); 
&lt;BR /&gt; 
&lt;BR /&gt;??? 
&lt;BR /&gt;Dave</description>
      <pubDate>Wed, 18 Nov 2009 18:59:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334408#M103081</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-18T18:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to get an environment variable from the system into a context var?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334409#M103082</link>
      <description>Hello Dave 
&lt;BR /&gt;Please use the following routine, it both works on windows and Unix/Linux. 
&lt;BR /&gt; 
&lt;PRE&gt;// template routine Java&lt;BR /&gt;package routines;&lt;BR /&gt;import java.io.*;&lt;BR /&gt;import java.util.*;&lt;BR /&gt;public class getEnv {&lt;BR /&gt;	static String value = null;&lt;BR /&gt;	public static String getEnvValue(String key) {&lt;BR /&gt;		try {&lt;BR /&gt;			Properties p = getEnv.getEnvVars();&lt;BR /&gt;			value = p.getProperty(key);&lt;BR /&gt;		} catch (Throwable e) {&lt;BR /&gt;			e.printStackTrace();&lt;BR /&gt;		}&lt;BR /&gt;		return value;&lt;BR /&gt;	}&lt;BR /&gt;	public static Properties getEnvVars() throws Throwable {&lt;BR /&gt;		Process p = null;&lt;BR /&gt;		Properties envVars = new Properties();&lt;BR /&gt;		Runtime r = Runtime.getRuntime();&lt;BR /&gt;		String OS = System.getProperty("os.name").toLowerCase();&lt;BR /&gt;		if (OS.indexOf("windows 9") &amp;gt; -1) {&lt;BR /&gt;			p = r.exec("command.com /c set");&lt;BR /&gt;		} else if ((OS.indexOf("nt") &amp;gt; -1) || (OS.indexOf("windows 2000") &amp;gt; -1)&lt;BR /&gt;				|| (OS.indexOf("windows xp") &amp;gt; -1)) {&lt;BR /&gt;			p = r.exec("cmd.exe /c set");&lt;BR /&gt;		} else {&lt;BR /&gt;			// it is Unix os.&lt;BR /&gt;			p = r.exec("env");&lt;BR /&gt;		}&lt;BR /&gt;		BufferedReader br = new BufferedReader(new InputStreamReader(p&lt;BR /&gt;				.getInputStream()));&lt;BR /&gt;		String line;&lt;BR /&gt;		while ((line = br.readLine()) != null) {&lt;BR /&gt;			int idx = line.indexOf('=');&lt;BR /&gt;			String key = line.substring(0, idx);&lt;BR /&gt;			String value = line.substring(idx + 1);&lt;BR /&gt;			envVars.setProperty(key, value);&lt;BR /&gt;		}&lt;BR /&gt;		return envVars;&lt;BR /&gt;	}&lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;Best regards 
&lt;BR /&gt; 
&lt;BR /&gt; shong</description>
      <pubDate>Thu, 19 Nov 2009 03:32:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334409#M103082</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-19T03:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to get an environment variable from the system into a context var?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334410#M103083</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;Hello Dave&lt;BR /&gt;Please use the following routine, it both works on windows and Unix/Linux.&lt;BR /&gt;&lt;PRE&gt;// template routine Java&lt;BR /&gt;package routines;&lt;BR /&gt;import java.io.*;&lt;BR /&gt;import java.util.*;&lt;BR /&gt;public class getEnv {&lt;BR /&gt;	static String value = null;&lt;BR /&gt;	public static String getEnvValue(String key) {&lt;BR /&gt;		try {&lt;BR /&gt;			Properties p = getEnv.getEnvVars();&lt;BR /&gt;			value = p.getProperty(key);&lt;BR /&gt;		} catch (Throwable e) {&lt;BR /&gt;			e.printStackTrace();&lt;BR /&gt;		}&lt;BR /&gt;		return value;&lt;BR /&gt;	}&lt;BR /&gt;	public static Properties getEnvVars() throws Throwable {&lt;BR /&gt;		Process p = null;&lt;BR /&gt;		Properties envVars = new Properties();&lt;BR /&gt;		Runtime r = Runtime.getRuntime();&lt;BR /&gt;		String OS = System.getProperty("os.name").toLowerCase();&lt;BR /&gt;		if (OS.indexOf("windows 9") &amp;gt; -1) {&lt;BR /&gt;			p = r.exec("command.com /c set");&lt;BR /&gt;		} else if ((OS.indexOf("nt") &amp;gt; -1) || (OS.indexOf("windows 2000") &amp;gt; -1)&lt;BR /&gt;				|| (OS.indexOf("windows xp") &amp;gt; -1)) {&lt;BR /&gt;			p = r.exec("cmd.exe /c set");&lt;BR /&gt;		} else {&lt;BR /&gt;			// it is Unix os.&lt;BR /&gt;			p = r.exec("env");&lt;BR /&gt;		}&lt;BR /&gt;		BufferedReader br = new BufferedReader(new InputStreamReader(p&lt;BR /&gt;				.getInputStream()));&lt;BR /&gt;		String line;&lt;BR /&gt;		while ((line = br.readLine()) != null) {&lt;BR /&gt;			int idx = line.indexOf('=');&lt;BR /&gt;			String key = line.substring(0, idx);&lt;BR /&gt;			String value = line.substring(idx + 1);&lt;BR /&gt;			envVars.setProperty(key, value);&lt;BR /&gt;		}&lt;BR /&gt;		return envVars;&lt;BR /&gt;	}&lt;BR /&gt;}&lt;/PRE&gt;&lt;BR /&gt;Best regards&lt;BR /&gt; &lt;BR /&gt; shong&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Thanks shong.</description>
      <pubDate>Thu, 19 Nov 2009 15:51:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334410#M103083</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-19T15:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to get an environment variable from the system into a context var?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334411#M103084</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;Hello Dave&lt;BR /&gt;Please use the following routine, it both works on windows and Unix/Linux.&lt;BR /&gt;&lt;PRE&gt;// template routine Java&lt;BR /&gt;package routines;&lt;BR /&gt;import java.io.*;&lt;BR /&gt;import java.util.*;&lt;BR /&gt;public class getEnv {&lt;BR /&gt;	static String value = null;&lt;BR /&gt;	public static String getEnvValue(String key) {&lt;BR /&gt;		try {&lt;BR /&gt;			Properties p = getEnv.getEnvVars();&lt;BR /&gt;			value = p.getProperty(key);&lt;BR /&gt;		} catch (Throwable e) {&lt;BR /&gt;			e.printStackTrace();&lt;BR /&gt;		}&lt;BR /&gt;		return value;&lt;BR /&gt;	}&lt;BR /&gt;	public static Properties getEnvVars() throws Throwable {&lt;BR /&gt;		Process p = null;&lt;BR /&gt;		Properties envVars = new Properties();&lt;BR /&gt;		Runtime r = Runtime.getRuntime();&lt;BR /&gt;		String OS = System.getProperty("os.name").toLowerCase();&lt;BR /&gt;		if (OS.indexOf("windows 9") &amp;gt; -1) {&lt;BR /&gt;			p = r.exec("command.com /c set");&lt;BR /&gt;		} else if ((OS.indexOf("nt") &amp;gt; -1) || (OS.indexOf("windows 2000") &amp;gt; -1)&lt;BR /&gt;				|| (OS.indexOf("windows xp") &amp;gt; -1)) {&lt;BR /&gt;			p = r.exec("cmd.exe /c set");&lt;BR /&gt;		} else {&lt;BR /&gt;			// it is Unix os.&lt;BR /&gt;			p = r.exec("env");&lt;BR /&gt;		}&lt;BR /&gt;		BufferedReader br = new BufferedReader(new InputStreamReader(p&lt;BR /&gt;				.getInputStream()));&lt;BR /&gt;		String line;&lt;BR /&gt;		while ((line = br.readLine()) != null) {&lt;BR /&gt;			int idx = line.indexOf('=');&lt;BR /&gt;			String key = line.substring(0, idx);&lt;BR /&gt;			String value = line.substring(idx + 1);&lt;BR /&gt;			envVars.setProperty(key, value);&lt;BR /&gt;		}&lt;BR /&gt;		return envVars;&lt;BR /&gt;	}&lt;BR /&gt;}&lt;/PRE&gt;&lt;BR /&gt;Best regards&lt;BR /&gt; &lt;BR /&gt; shong&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Thanks - I ended up using getEnv("CCR_HOME") in java, and that worked fine.</description>
      <pubDate>Fri, 20 Nov 2009 16:05:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334411#M103084</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-20T16:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to get an environment variable from the system into a context var?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334412#M103085</link>
      <description>You can simply use System.getenv("myvar") in java, without an external code.&lt;BR /&gt;bye</description>
      <pubDate>Sun, 22 Nov 2009 17:22:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334412#M103085</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-22T17:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to get an environment variable from the system into a context var?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334413#M103086</link>
      <description>right - that worked great.&lt;BR /&gt;Thanks,&lt;BR /&gt;Dave</description>
      <pubDate>Mon, 30 Nov 2009 16:08:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334413#M103086</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-11-30T16:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to get an environment variable from the system into a context var?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334414#M103087</link>
      <description>Shong,
&lt;BR /&gt;Nice solution. Thanks!</description>
      <pubDate>Thu, 17 Dec 2009 19:17:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334414#M103087</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-12-17T19:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to get an environment variable from the system into a context var?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334415#M103088</link>
      <description>&lt;P&gt;There is a custom component for this in Talend Exchange -&amp;nbsp;&lt;A href="https://exchange.talend.com/#marketplaceproductoverview:marketplace=marketplace%252F1&amp;amp;p=marketplace%252F1%252Fproducts%252F181&amp;amp;pi=marketplace%252F1%252Fproducts%252F181%252Fitems%252F240" target="_blank" rel="nofollow noopener noreferrer"&gt;tGetEnvVarInput&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2016 14:24:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-get-an-environment-variable-from-the-system-into/m-p/2334415#M103088</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-02-22T14:24:12Z</dc:date>
    </item>
  </channel>
</rss>

