Skip Navigation

I found a tool that allows compiling Rust to JVM bytecode (make JAR files from Rust, if you dare?)

github.com GitHub - davidar/lljvm: Low Level Java Virtual Machine

Low Level Java Virtual Machine. Contribute to davidar/lljvm development by creating an account on GitHub.

GitHub - davidar/lljvm: Low Level Java Virtual Machine

I thought this might interest you Rust folk. This is kinda like an LLVM bitcode to JVM bytecode translator. So run rustc with --emit=llvm-ir (I think that's the flag) and then pass the bitcode image to this program, then get JVM bytecode which you can make a JVM bytecode archive (JAR) from it. Could be an interesting? The author says it can JVM code from Clang output, so why not Rustc?

Keep in mind that these are two different beasts, JVM is designed for a safe virtual machine and LLVM is chiefly used to be translated into machine code. However, stupider and more wonderful things have been done with LLVM and JVM, for example, there's an LLVM to 6502 translator, so you could be making NES games with Rust.

I will test this in a few days, busy implementing my own JVM (hope I can do it) and I don't have the Rust toolchain installed on my system. But hey maybe someone can make a Cargo plugin from it (is it possible?)

Thanks, later.

30
30 comments
You've viewed 30 comments.