Is there a way to run plain c code on top of the JVM?
Not connect via JNI, running, like you can run ruby code via JRuby, or javascript via Rhino.
If there is no
As of 2016 there is a young but promising option called gcc-bridge. Its intend is to leverage the JVM's implementation of R. The goal is to use R-libraries written in C or Fortran. But gcc-bridge can be used independently as a regular maven plugin. Also see the gcc-brigde-example.
Updated 2012-01-26: According to this page on the company's site the product has been bought out and is no longer available.
Yes.
Here's a commercial C compiler that produces JVM bytecode.
It seems that LLJVM can also meet your requirement.
LLJVM: Source code is first compiled to LLVM intermediate representation (IR) by a frontend such as llvm-gcc or clang. LLVM IR is then translated to Jasmin assembly code, linked against other Java classes, and then assembled to JVM bytecode.
There are two other possibilities, both open-source:
JPC emulates an entire x86 pc within the JVM, and is capable of running both DOS and Linux.
NestedVM provides binary translation for Java Bytecode. This is done by having GCC compile to a MIPS binary which is then translated to a Java class file. Hence any application written in C, C++, Fortran, or any other language supported by GCC can be run in 100% pure Java with no source changes.
Maybe not exactly what you need but a commercial option is http://www.axiomsol.com/