java - 从 Java 程序创建 Mac OSX 包

标签 java macos bundle executable

假设我写了一个简单的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/

相关文章:

javascript - 如何让gh-pages找到bundle.js

java - 将 java.time 转换为日历

java - 当我将 Intellij IDEA 配置为使用 Java6 时,使用 java7 编译器进行编译

c++ - 如何为 mac el capitan 安装 qt4?

macos - 如何使 AddressSanitizer 在出现错误(和其他问题)后不会停止

ios - Qt-creator 示例无法为 iphonesimulator 构建

android - 如何将可变列表传递给 bundle ?

mysql - 无法在/usr/local/bin/mysql_config执行mysql_config

java - Spring 安全和 Thymeleaf 不起作用

java - 如何将输入的计算存储到内存、输入重复、输入的第一个计算添加到输入的第二个计算等等?