假设我写了一个简单的Java程序,就是以.java结尾的文件,我可以用javac编译,然后用java运行...
我如何创建一个 Mac OSX 可执行文件 (.app) 包,以便我可以将它发送给其他人,然后他们可以通过双击在他们的 Mac 上启动它?
最佳答案
你应该检查的是javapackager ,尤其是参数 native 及其值 image
javapackager -deploy -native image -appclass fqn.of.MyClass -srcfiles /path/to/my.jar
-native type
Generate self-contained application bundles (if possible). Use the -B option to provide arguments to the bundlers being used. If type is specified, then only a bundle of this type is created. If no type is specified, all is used.
The following values are valid for type:
all: Runs all of the installers for the platform on which it is running, and creates a disk image for the application. This value is used if type is not specified.
installer: Runs all of the installers for the platform on which it is running.
image: Creates a disk image for the application. On OS X, the image is the .app file. On Linux, the image is the directory that gets installed.
dmg: Generates a DMG file for OS X.
pkg: Generates a .pkg package for OS X.
mac.appStore: Generates a package for the Mac App Store.
rpm: Generates an RPM package for Linux.
deb: Generates a Debian package for Linux.
关于java - 从 Java 程序创建 Mac OSX 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39213535/