My C program opens a pipe and gets a file descriptor. Then it start a JVM with JNI and sends the file descriptor to the Java side. Is it now possible for me to write data to this pipe using the file descriptor from the Java code?
So, the only thing you can do is to create a new, specialized subclass of java.io.OutputStream (in practice you'd probably subclass BufferedOutputStream) which would take an integer file descriptor as a constructor argument. You'd then have to rewrite the functionality of java.io.FileOutputStream yourself, including the native code and JNI bridge. This is a bit of a pain, but it's not especially difficult.