Error Running tSystem Component Dynamically

Four Stars

Error Running tSystem Component Dynamically

Hi,

 

I have a requirement in which I need to generate a list of email addresses based on the country. For example for country "BE" I need to send emails to say a list containing 5 peoples, for "NL" that would change to another list containing 8 peoples and so on. To have this done, we have a java code that we execute from Talend using tSystem component. The command to generate the list is 

"java -jar /abc/dev/DynamicEmail/Userlist.jar /abc/dev/Outfile/Email/BE/BE_List.txt /abc/dev/DynamicEmail/Properties/BE/RoleProperties.properties"

 

Now in our requirement 10 more countries needs to get added. For that reason, we are thinking of generalizing the code so that we would pass the value of Country and Environment dynamically and then create our command. 

 

We are using the tJava component to create the command. The code for the same is as under:

context.EmailCommand = "java -jar /abc/" + context.Environment + "/DynamicEmail/Userlist.jar /abc/" + context.Environment + "/OutFile/Email/" + context.CountryOfExecution + "/"+ context.CountryOfExecution + "_List.txt  /abc/" + context.Environment + "/DynamicEmail/Properties/" + context.CountryOfExecution + "/RoleProperties.properties";

But the tSystem component is giving an error  ""java": error=2, No such file or directory

 

I have also tried to have the command generated within quotes. But that is also not helping.

 

Could you please guide me on where I am going wrong.

Forteen Stars

Re: Error Running tSystem Component Dynamically

1st what You need to check - is Talend inherit OS environment variables, simplest way - add in tSystem only command

"set | grep PATH"
or
"echo $PATH"

(in case of Linux or macOS), it print what PATH environment You have for Talend

 

2nd - not necessary, just to be sure - what are You try to run, test in tSystem:

"echo "+context.EmailCommand

if as I can guess - java not in path, You would need to fix this, depending from Your OS. 

-----------

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog