One Star

how to call external Java application in talend?

Hi all,
We implemented one logic with java code,this is located in eclipse.
I want to call external java code in Talend, then the java code is execute in eclipse.
how to call external java code in talend?
Thanks in Advance.
Regards,
kumar.talend
4 REPLIES
Seventeen Stars

Re: how to call external Java application in talend?

hi,
have a look at :
https://help.talend.com/search/all?query=Calling+a+Talend+Job+from+an+external+Java+application&cont...
PS : Don't forget to use search Talend forum option OR Talend help center ... there are a lot of great informations about Talend. Smiley Happy
regards
laurent
Five Stars

Re: how to call external Java application in talend?

Hi Kumar,
Please find below some steps that you can use to get a Talend based job called from within Eclipse.
You will want to use the 'Export Job' option on the job you want to call. This will create the jar files needed to call the java class. Once you have done that, unzip the file and copy the jar files in a folder that resides within an Eclipse project. We use a project to hold jar files from external sources which these are.
Once you have the jar files copied to your Eclipse workspace, add the jar files to the classpath (aka buildpath) of the project that holds the class that will be calling your Talend based job.
From here you just need to add a few lines of java code to call your job. See below sample code.
NOTE: The Sample_TalendJob reference listed below is the name of the job within Talend that you exported.
Also, the below example has a date value being passed in via the argument list.
String[] etlArgs = { "--context=custom", "--context_param processDate=" + processDate };
String returnCode[][];
Sample_TalendJob sampleTalendJob = new Sample_TalendJob();
returnCode = sampleTalendJob.runJob(etlArgs);
if (returnCode.equals("0")) {
// job ran without error
} else {
// job encountered error
}
Hope the above helps.
Tom
Two Stars

Re: how to call external Java application in talend?

Hi , I am already doing the same , but this might be the case that Talend is not throwing the exception in my scenario and is simply writing on to the console . and hence , the exception is not caught.
Thanks for the timely response.
Moderator

Re: how to call external Java application in talend?

Hi yadavjyoti24,
Have you tried to use  tlogcatcher component in your job? Which can be used to capture exception and log them(console, file or db table ).
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.