Cross-compilers do not exist (well, not *really*) for Java to C for several reasons. The biggest reason the the way that each language handles memory. I have used both, so I can tell you from experience.
C has two types of in-memory data:
- Pre-defined variables
- Dynamically allocated memory from the "heap".
"Heap" is a large amount of memory that is created when a program in loaded into "active space". In essense, every C program runs in a "virtual machine" created when you run it. C programs often "dynamically allocate" more memory as it needs it. But the original programmer had to be very careful about cleaning up after memory it allocated -- free it when no longer in use. Also, C programs can overwrite its own "non dynamic" variables because C does not have any mechanisms to "stop at defined size".
In short, C is a world of landmines, especially concerning memory.
Java was supposed to fix that.
The JVM is a world that manages its own memory. It has several advantages over C:
- Memory for every variable comes off the "heap"
- Memory for variables that have no more "references to them" are eliminated (called "garbage collection")
- The sizes of all variables are known all along, so no variables can be ovewritten.
Java was also created to always use the same "low-level code". Whether it runs on Windows, Mac, Linux the "program" can be the same and the JVM handles the translation into the "machine-level" code reauired to run.
C code *MUST* be in the machine-specific code that each specific class of CPU knows. PowerPC is the prime example: PPC apps are compiled for a chipset that no longr is made, so a "virtual machine" (Rosetta) is required to execute it.
There is no good way to bridge that gap between "manually managed memory and machine-specific pre-compiled instructions" and "JVM with commonly-used intermediate language codes".
Sorry.
If you did start to learn to re-write in C, you have a fairly steep leraning curve.