Why detecting the operating system at run time?
As Talend Studio supports cross-platform Job execution and development on one or
several machines, you often need to know the current operating system when running a
Talend Job.
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.
Detecting the operating system at run time and dynamically setting the file path
To allow the Job to run on different operating systems, you can set the file path using a context variable as in the following example Job.
This Job is composed of:
- a tJava component to initialize the context variable and detect the operating system,
- a FixedtFlowInput component to generate data,
- a tFileOutputDelimited component to generate a .txt file.