ANSI-C Wrapper

Hello, I would like to create a node to run a C program. The program reads and writes 3D molecular structures. Is ti possible *without* translating the whole application in Java? Many thanks PS there was a similar post some years ago:


yes, by using the Java JNI technology. You basically have to:

  • Design a Java class with the methods you need (using the native keyword)
  • Generate the C-stubs using the command: javah -jni MyClass (See example below)
  • Implement the generated stubs to call your native methods.
  • Load your native library wrapper

If you native library is a COM object, it’s slightly more involved.

There’s a lot of info on this on the Web, for example:

Here’s a simple example:

public final class MyClass implements IMyClass {
private final native String nativeGetProperty();

public final String getGetProperty() {
    return nativeGetProperty();

static {
    System.loadLibrary("myWrapperAroundNativeLibrary"); // NOTE: No DLL endings; libraries must be in PATH



thanks for the answer. JNI may be overkill. I wrote a wrapper using


It works fine on OS X and Linux.

I’ll see if I can use it in KINME

Let’s put it another way

  • suppose I have an ANSI C application MyCApp, that runs from the command line :
      MyCApp < input > output
  • suppose I have written a Java wrapper class that starts the above process, i.e. produces the output from the input :
      java CWrap input output

    is that enough to write a KNIME node to start the C application ?

      Thanks !
    • Yes it works very well.

        I used the standard Java class
            to write a wrapper for the C application. I then call it from the "execute" method of the Model class.