I plan to build a workflow with many Java Snippets. Each of these Java snippets will make use of the same external .jar file. I know that I can use the "additional Libraries" tab to specify .jar files for import, but there is one problem: The path to the jar files is system-dependent. Therefore I cannot simply copy/export a workflow to a different machine and expect it to work.
Therefore: How can I set/change the classpath globally for a KNIME instance, so that any additional classes can be directly imported without further configuration?
I already tried
But that did not work.
Alright, I found a better solution than working with the classpath:
In the Java Snippet node I can either add
- The path to a local jar file
- A KNIME url
My previous post talked about the problems with option 1. But option 2 actually solves my problem quiete nicely. I can simply use knime://knime.workflow/MyJarFile.jar as an URL and place the jarfile at knime-workspace-directory/workflow-directory/MyJarFile.jar. I can then simply copy/export the whole workflow directory and the jarfile will travel along with it.
Great to hear that you were able to find a solution! Yes, workflow-relative URLs should be the preferred option if you want to ensure compatibility across systems.