Compiler to translate Java bytecode to platform-independent C code before runtime?

后端 未结 7 2025
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-28 10:40

I\'m looking for a compiler to translate Java bytecode to platform-independent C code before runtime (Ahead-of-Time compilation).

I should then be able to use a sta

7条回答
  •  情歌与酒
    2020-12-28 11:13

    AFAIK, there is no such product but you have two options:

    • Implement your own byte-code to C transpiler. Byte-code is pretty simple, this isn't too hard.

    • If you just want a native binary (i.e. when you don't need the C source code), then give GCJ a try.

    Note: If you're doing this for performance reasons, then you're going to be disappointed. Java is generally as fast as C/C++. Moreover, improvements to the VM will make all Java code faster but not your native binary. Compiling the code will just give you a little better startup time.

提交回复
热议问题