Skip to main content Skip to complementary content

Integrate the Talend Job into Eclipse

Follow the steps to import the Talend Job into a Java project in Eclipse:

Procedure

  1. Launch Eclipse and create a new Java project.

    For this example, call it P1.

  2. Create a new Java class called TalendExample that will call the Talend Job.
  3. Right-click the root folder of the P1 project, then select Build path.
  4. Then select the Configure Build Path option.
  5. In the next window, open the Libraries tab and click the Add external Jars button to import the Job jar and all the dependent jars.

    For example, this demo Job contains the following jars (Located in <Job script unzip dir>\CallJobInEclipseDemo\):

    • calljobineclipsedemo_0_1.jar
    • axis.jar
    • dom4j-1.6.1.jar
    • jaxrpc.jar
    • systemRoutines.jar
    • talend_file_enhanced_20070724.jar
    • talendcsv.jar
    • userRoutines.jar
  6. Import the context configuration file Default.properties:
    1. Open the <Job script unzip dir>\CallJobInEclipseDemo folder.
    2. Copy the di_demo folder (di_demo is the project name in this example).
    3. In Eclipse, paste it to the src folder.
  7. Open the TalendExample.java class and edit its code as follows:
    package org.talend;
    import di_demo.calljobineclipsedemo_0_1.CallJobInEclipseDemo;
    public class TalendExample {
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		CallJobInEclipseDemo talendJob=new CallJobInEclipseDemo();
    		talendJob.runJob(new String[]{});
    	}
    }
  8. Execute the TalendExample.java class
  9. Open the file D:file/out.txt and see whether a new line of data is appended.

    If so, it means the Job has been executed successfully in the Java program.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!