You often need to know the current operating system when running a Talend Job. Talend Studio supports cross-platform Job execution, and allows you to develop Jobs on one machine and run them on other machines. Some components such as File components always require a local file path. Operating systems do not all have the same format for paths in the file system.
In order to make the Job run on different operating systems, the component needs to detect the current operating system type and set a dynamic file path at runtime.
This procedure was written with:
Talend verified this procedure to be compatible with:
To allow the Job run on different operating systems, you can set the file path using a context variable. The context variable gets initialized at the beginning of the Job. For example, we detect the operating system and initialize the context variable in the tJava component as follows:
To help clarify this example, here is an example Job named DetectOSTypeDemo. The detailed Job settings can be seen below: