Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
IrwanAfandiGDP
Contributor
Contributor

Add environment path in Talend

Hello... could someone help me!

I tried to make a custom component. Then inside of @AfterGroup, I want to read a path that already made in my mac environment "System.getenv("my_global_variable")", but It returns null because there is no my_global_variable. Then I tried to output all possible variables inside the talend and I found this (It's different with my mac environment).

How can I add a variable like JSON_INPUT : /Users/mohamad.i.afandi/data/data.json inside the talend environment? Thank you

0695b00000F7d1bAAB.png

4 Replies
undx
Creator
Creator

Hi @Mohamad Irwan Afandi​ ,

Setting some env vars in macos may be tricky when running gui apps...

Why don't you use a configuration item (@Option) in your processor's config ? If it is used in your processor workflow, it will be more clean.

This value will be injected in your configuration, it's neater than unpredictable behavior coming from outside world...

Thus, In the Studio, you should be able to use context variables for this configuration option.

 

Best regards.

 

--

Emmanuel

IrwanAfandiGDP
Contributor
Contributor
Author

I see, so I need to create a text box inside the component's basic settings. Then I retrieve the user input value from the text box. With this method I can use user input value in my java.

 

Btw, is there a way to add new environment variable inside the talend environment @Emmanuel GALLOIS​ ? Because my talend component will execute python script using Runtime.getRuntime().exec(). Then I need some path location like python interpreter, python file, json file, etc that I want set it inside Java code. So if someone want to use the component, they can set the specific location on talend environment before run the component (I thing talend env is different with macos env).

undx
Creator
Creator

Hi @Mohamad Irwan Afandi​ ,

Not sure that's related to Talend Studio but more related to GUI apps in osx.

How do you launch the studio, with the GUI launcher ? Maybe have a look at https://superuser.com/questions/476752/setting-environment-variables-in-os-x-for-gui-applications

Otherwise, you may try to launch it directly via your shell. Normally the environment should be propagated correctly.

 

Best regards

 

IrwanAfandiGDP
Contributor
Contributor
Author

Thank you @Emmanuel GALLOIS​ , it's work on my project