我尝试了GCJ,它编译得很好。我尝试了 Ubuntu 和 Windows。编译后的文件在我的 Ubuntu 机器上运行,还有带有 wine 的 .exe。但是,如果我尝试在我的 Ubuntu 服务器上运行,我会收到此错误:
error while loading shared libraries: libgcj.so.14: cannot open shared object file: No such file or directory
但我认为我不需要安装任何东西来运行“本机”代码。我也无法在 Windows 机器上运行 .exe。
你能告诉我为什么会这样吗?也许我编译错了。我用这个:gcj --main=Hello -o hello.exe Hello.jar
对于窗户。