Link on the server through Java

Hello,

In the past I was generating Excel files through the Excel Writer using the following path: \$(RunDirectory)/lnkfls/excelExport.xlsx

Afterwards I was making this file available through a link defined in an Image to file component. This was the link:

http://\$(Servername):\$(ServerPort)/jobs/\$(UserName)/\$(RunId)/lnkfls/excelExport.xlsx

However I finally decided to generate this Excel file in Java and to use the same path in this way:

FileOutputStream fileOut = new FileOutputStream("\$(RunDirectory)/lnkfls/excelExport.xlsx");

But in this case I get the following error:

/apps/pp/web/jobs/t752887/{ppc2C127-206F-746D-CECD-33E1426E6C22}/lnkfls/excelExport.xlsx (No such file or directory)

If I replace

FileOutputStream fileOut = new FileOutputStream("\$(RunDirectory)/lnkfls/excelExport.xlsx");

with

FileOutputStream fileOut = new FileOutputStream("\$(UserDir)/excelExport.xlsx");

Then I get it in my repository (but I don't know then what's the url to download it).

What did I do wrong?

Thanks for your help

Florent