3

我知道java意图是针对gui和多平台的,但是我面临的问题是如何将java应用程序发布到我无法控制的linux服务器中,即我不知道如果安装了java vm一点也不。

那么,我如何将它编译成一个真正的独立 linux exe,不要假设目标 linux 上有任何预安装的包。

public class MyTest {
    public static void main(String[] args) {

        System.out.println("You passed in: " + args[0]);

    }
}
4

3 回答 3

2

You need to specify as a requirement an installed JRE.
Otherwise you would need to deliver a JRE yourself as part of the deliverable application

于 2013-03-18T14:10:17.510 回答
1

从 java 创建一个二进制文件可能不是那么好。您可以考虑使用http://launch4j.sourceforge.net/ 之类的工具来创建完整安装以及适当的 jre。

于 2013-03-18T14:12:08.210 回答
1

The GNU COmpiler for Java does exactly this. Keep in mind that it will work properly only for small programs, either way you'll need a JVM.

There's also Avian, which has another approach and allows to deploy a lightweight JVM with jour application, but it still hasn't all the features of a full JRE.

于 2013-03-18T14:09:47.200 回答