I have a Java Snippet that runs a .JAR file class in a try/catch block and saves its console output to a flow variable called “new variable”. However, the KNIME Java Snippet is unable to grab the output from the try block, and assigns the flow variable to the value of the original initialization. I’ve attached the code and my results below.
The code works fine on my local IDE and I am able to save the output to a variable and view it on the command line, so what would be the problem here and how can I debug it? Thanks!
I’d guess that the exception flies before the string is assigned.
You can add some logging to the catch or rethrow the exception (I think there’s an Abort wrapper which you can use; see the node documentation). This way the error and stack trace will be propagated to the UI.
Yep, after using Abort it looks like it was throwing the exception first. It seems like the code is throwing an error on the is.read(b, 0, b.length-2);.