<?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: Get exit code of a job run from an external java application in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Get-exit-code-of-a-job-run-from-an-external-java-application/m-p/2251035#M35092</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; Since you are using the main class, it is giving the exit condition as 0.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Could you please try below code snippet?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;String[] args = {};

local_project.helloworld_0_1.helloworld obj1 = new local_project.helloworld_0_1.helloworld();

int exitCode = obj1.runJobInTOS(args);

if (exitCode != 0)

	      {
	
	throw new NullPointerException("Demo exception - Child job failed !!!! "); 
	}&lt;/PRE&gt; 
&lt;P&gt;Warm Regards,&lt;BR /&gt;Nikhil Thampi&lt;/P&gt; 
&lt;P&gt;Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Dec 2018 11:36:58 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-12-20T11:36:58Z</dc:date>
    <item>
      <title>Get exit code of a job run from an external java application</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Get-exit-code-of-a-job-run-from-an-external-java-application/m-p/2251034#M35091</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am developping a little java application that can run a job depending on some conditions.&lt;/P&gt;
&lt;P&gt;All I want is to know inside my java code if the job run successfully or not.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my code :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        job_launcher talendJob = new job_launcher();
        String [] context = new String[] {"--context_param row_id="+customMessage.toString()};
        String[][] code = talendJob.runJob(context);

        for(String[] s : code){
            for(String s2 : s){
                log.info(s2);
            }
        }&lt;/PRE&gt;
&lt;P&gt;The problem is that the returning code is always 0, even if my job throws a null pointer exception or something else.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So how can I proceed to determine if my job failed ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Guillaume&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 10:44:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Get-exit-code-of-a-job-run-from-an-external-java-application/m-p/2251034#M35091</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-20T10:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get exit code of a job run from an external java application</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Get-exit-code-of-a-job-run-from-an-external-java-application/m-p/2251035#M35092</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; Since you are using the main class, it is giving the exit condition as 0.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Could you please try below code snippet?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;String[] args = {};

local_project.helloworld_0_1.helloworld obj1 = new local_project.helloworld_0_1.helloworld();

int exitCode = obj1.runJobInTOS(args);

if (exitCode != 0)

	      {
	
	throw new NullPointerException("Demo exception - Child job failed !!!! "); 
	}&lt;/PRE&gt; 
&lt;P&gt;Warm Regards,&lt;BR /&gt;Nikhil Thampi&lt;/P&gt; 
&lt;P&gt;Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 11:36:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Get-exit-code-of-a-job-run-from-an-external-java-application/m-p/2251035#M35092</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-20T11:36:58Z</dc:date>
    </item>
  </channel>
</rss>

