Re: calling c code from java
First guess is that the c code you are running is missing some sort of input (say perhaps a command line argument that specifies the file name to write to for the fprintf call?), but without further info there's no way to be sure. Can you provide a bit more info (eg code)? Are you using Runtime.exec? Have you provided all command line arguments necessary?
Re: calling c code from java
In simple terms, just make sure you load the relevant library which contains the function definition, load the library which follows the JNI specification and wraps the target function from the first library, expose native methods from your Java class and you should be good to go.
I'd recommend against raw JNI since it contains a lot of boilerplate code and you would end up cursing yourself if you start wrapping a big C library. By all means do feel free to dabble in JNI when starting out but use something like JNA when it comes to real work.
Re: calling c code from java
@nicz17: This is an ancient thread and what you copy/pasted off the internet is not more than others could have found for themselves.
Please don't resurrect old threads, especially when you have no opinion of your own to add. It's annoying.