Set Java nodes "system imports"

Hi,

I would like a library to be available in every Java Snippet node, by default. I was wondering if it is possible to configure the “system imports” list, so I can have the same one for the entire workflow (without having to add some libraries as “custom imports” each time).

Cheers

2 Likes

Hi,
unfortunately this is not possible, but the jar files can be controlled using a flow variable. So if you want to simplify this a bit, create a component that returns a list of jar files as flow variable and then connect that to the Java Snippet. In the configuration window under “Flow Variables” you can then assign the parameter “jarFiles” to your flow variable. For even more convenience, put your jar files into a folder (e.g. “java_libraries”) in the root of your workspace. Then simply use a List Files node in the component with folder knime://knime.mountpoint/java_libraries and filter “.jar”. Use a GroupBy node to aggregate all URLs into a list, rename the column to something understandable using Column Rename and turn that into a flow variable using Table Row to Variable. The result can then be passed out of the component.
Kind regards,
Alexander

3 Likes