从Java程序创建Mac OSX捆绑软件 [英] Creating a Mac OSX bundle from a Java program
问题描述
让我们假设我编写了一个简单的Java程序,即以.java结尾的文件,可以使用javac进行编译,然后再使用java ...来运行.
Let's assume that I wrote a simple Java program, that is the file ending with .java that I can compile with javac, and then run with java...
如何创建Mac OSX可执行文件(.app)捆绑包,以便可以将其发送给其他人,然后他们可以双击在Mac上启动它?
How do I create a Mac OSX executable (.app) bundle, so that I can send it to others who will then be able to launch it on their Macs with a double click?
推荐答案
What you should check is javapackager, especially the parameter native and its value image
javapackager -deploy -native image -appclass fqn.of.MyClass -srcfiles /path/to/my.jar
-native type
生成独立的应用程序捆绑包(如果可能).使用-B 为使用的捆绑器提供参数的选项.如果类型是 指定,则仅创建此类型的捆绑包.如果没有类型 指定,将全部使用.
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.
以下值对类型有效:
全部:运行其所在平台的所有安装程序 运行,并为应用程序创建磁盘映像.这个值是 如果未指定类型,则使用此
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.
映像:为应用程序创建磁盘映像.在OS X上,映像为 .app文件.在Linux上,映像是获取该目录的目录. 已安装.
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 :为OS X生成DMG文件.
dmg: Generates a DMG file for OS X.
pkg :为OS X生成.pkg软件包.
pkg: Generates a .pkg package for OS X.
mac.appStore :为Mac App Store生成软件包.
mac.appStore: Generates a package for the Mac App Store.
rpm :为Linux生成RPM软件包.
rpm: Generates an RPM package for Linux.
deb :为Linux生成Debian软件包.
deb: Generates a Debian package for Linux.
这篇关于从Java程序创建Mac OSX捆绑软件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!