Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Pass filename to tFileInputDelimited from java

I call a Job from java, that must open a .csv file and do something with the content...
I need to be able to configure the name and path of the file to read.
How do I do that?
I would prefer to be able to set a parameter in a .properties file or to call runJob(...) from java with the filename as a parameter.
Regards
Morten
Labels (3)
3 Replies
_AnonymousUser
Specialist III
Specialist III

You can use context variables for nearly every setting. This contexts and their variables can be accessed and changed in a ContextName.properties file in your exported job.
To set and use context variables, just press F5 in a Talend settings field or set them directly via contexts tab in the lower part of the Talend window.

Regards
Theo
Anonymous
Not applicable
Author

Thanks, that clarified quite a bit.
Now I can create the context variable and use it from Talend.
I can export the job script to a zip file containing libraries, the job in a .jar file.
Now I want to be able to change the properties, in the job, that is started from an existing application. This means that I need to be able to edit the properties file and use that.
The .properties file is a part of the .jar file, so editing that and using the .jar file afterwards would require that i unzip the jar, edit it and jar it again.
I would like to be able to control it from java, like setting the context by passing the context to the runJob method:
runJob("--context=Production");
and refer to a Production.properties file somewhere in the classpath.
Where should I put the Production.properties file if the described way of using the job works?
Anonymous
Not applicable
Author

.properties file have to be stored in the classpath of YOUR java classes at runtime.
HTH,