How to access files stored in the Data area of Business Hub workflow by using Java Snippet

Hello everyone

I want to access a file on the host OS by using the “Java Snippet” node of the workflow.
Because Business Hub can not access file in the Host OS , I have to upload the file to the Data area of the Business Hub workflow.
Would you please tell me how to access files stored in the Data area of a workflow by using Java Snippet with the JDK (e.g. java.io.File)?

I have tried to use new File(“knime://knime.workflow/data/FileName”) to access the file in the “Java Snippet” node of the workflow.
It does not seem to work.

Thanks in advance.
Ryu

Hi Ryu,
I would recommend using the Extract Context Properties node to get a flow variable with the workflow’s absolute path. Pass this variable into your Java Snippet and there you can append /data/FileName to the absolute path to access your workflow’s data area.
Kind regards,
Alexander

1 Like

Hello @AlexanderFillbrunn

Thank you so much.
it works like a charm.

Best regards.
Ryu

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.