This node allows you to execute arbitrary java code to create new columns or replace existing ones. Enter the java code in the text area.
Output columns are defined by creating and binding a java field for each column. The value assigned to this field will be written to the output.
This node allows adding or modifying flow variables in the same manner.
It is also possible to use external java libraries (libraries that are not part of java boot classpath). In order to include external jar or zip files, add their location in the "Additional Libraries" tab.
Advanced users may want to make use of a library that is already present in the KNIME Analytics Platform installation as a bundle. Adding them to the list in the "Additional Bundles" tab will make them available to the java snippet's classpath.
You can define reusable templates with the "Create templates..." button. Templates are stored in the user's workspace by default and can be accessed via the "Templates" tab.
Contains the Java code editor to edit the snippet.
Enter your java code here. You can access input columns or flow variables by defining them in the "Input" table of the dialog. Alternatively use the methods getCell(name, type) or getFlowVariable(name, type) where name is the name of the input column or the flow variable. You can use the following values for the type parameter.
Java Snippet Code
For flow variables:
* For these methods there is a variant that takes the column index instead of its name.
Note that the snippet allows defining custom global variables and imports.
Exceptions in the snippet are caught by the framework and will
result in missing values for all output columns of the row being
processed—unless there are flow variables defined by the
snippet (in which case the execution will always fail).
You can force the node to fail execution by throwing an exception
CTRL+SPACE for auto completion will popup a list with all classes, methods and fields available at your current cursor location.
ENTER will generate missing import statements for a selected class.
This tab allows adding custom java library archives to make them available on the classpath of the java snippet.
This tab allows making installed bundles available on the
classpath of the java snippet, allowing you to use classes e.g.
from org.apache.commons, org.json, com.google.guava and more.
Once a bundle has been added, its version will be saved with the settings. Should the bundle not be present on an installation the workflow is then opened with, the node will produce an error and not run.
Should the bundle be present but in another version, it will suffice as long as the major version did not change and the minor version is larger or equal to the version the workflow was saved with ("semantic versioning").
You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.
A zipped version of the software site can be downloaded here.
Deploy, schedule, execute, and monitor your KNIME workflows locally, in the cloud or on-premises – with our brand new NodePit Runner.Try NodePit Runner!
Do you have feedback, questions, comments about NodePit, want to support this platform, or want your own nodes or workflows listed here as well? Do you think, the search results could be improved or something is missing? Then please get in touch! Alternatively, you can send us an email to email@example.com, follow @NodePit on Twitter, or chat on Gitter!
Please note that this is only about NodePit. We do not provide general support for KNIME — please use the KNIME forums instead.