A. N. Other
A. N. Other

Reputation: 489

Creating a Mac OSX bundle from a Java program

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?

Upvotes: 2

Views: 155

Answers (1)

Nicolas Filotto
Nicolas Filotto

Reputation: 44965

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.

Upvotes: 1

Related Questions