Creating a Mac OSX bundle from a Java program

て烟熏妆下的殇ゞ 提交于 2019-12-12 20:05:47

问题


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...

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?


回答1:


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

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.



来源:https://stackoverflow.com/questions/39213535/creating-a-mac-osx-bundle-from-a-java-program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!