[resolved] Load jar and add import to job in custom component
Hi,
I want to design an custom component to load an custom jar, do standard code and add import to my job (I use my customs classes in other tJava). My objectif is put this component in all job to preset imports and jar load. I can build my component and refer to my jar but I can't found how add import in job imports section like tJava component, I want an import parameter in advanced settings and put to import class.
Someone know how do it? I look in tutorials on Net but found nothing.
Please help!
Hi, Do you mean how to import and use a external jar? There are two ways for you to export the external jar files: 1)Using tLibraryload component to load the jar file at the begininig of job. for example: tLibraryLoad | tJava(on tJava, use the external API) 2)Creating custom routine, import the external jar file by clicking on the rouinte name and edting the routine libraries, and then call this routine in the job. Is that what you need, please check and tell us the result. Best regards Sabrina
Hi Sabrina,
I actually use the tLibraryLoad and tJava model in my job but I want encapsulate this in a component to just have one component to drop. I have a ot of jobs and other developpers use my jar. So with an preset component it will easier to use.
Also, I can't use an routine cause I have multiple projects in same deploiement and all projects export routine in "userroutine.jar" so I can't have more that one jar with same name.
I progress in my developpement of my component but the only think I miss is how add import in job by component like the tJava advenced setting do?
Thanks
Tousmaintertrade
I want my custom component to call into my very own custom JARs. How do I do that? Where do I place those JARs? How do I declare them in <CODEGENERATION.../> section of my ..._java.xml file?
Hi vshlimovich
I suggest you to refer to the official components, the source files of official components are located in <Talend Studio install dir>/plugins/org.talend.designer.components.localprovider_x.x.x.rxxxxxx\components folder.
- Put the jars in the same folder as the source files of component.
- In the ..._java.xml file, declare the jars in the <CODEGENERATION> element, for example: