One Star

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.

1 REPLY
Highlighted
Ten 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. 

-----------