10

I have a java application with jar file and a lib folder to go with it,and i want to bundle my application along with the lib files and folders into a .DMG file to run on MAC OS x so if anybody has a similar experience please help me out.

Thanks in advance

Jinith
  • 997
  • 6
  • 14
  • 27
  • See [convert java app to mac installer…dmg ](http://stackoverflow.com/questions/2174849/convert-java-app-to-mac-installer-dmg). – Matthew Flaschen Dec 09 '10 at 07:39
  • See new documentation by Oracle for Java 9: [*Self-Contained Application Packaging*](https://docs.oracle.com/javase/9/deploy/self-contained-application-packaging.htm#JSDPG583) – Basil Bourque Aug 19 '17 at 20:05

4 Answers4

8

You put all your files in one folder together. Then you open the Disk Utility (Applications -> Utilities -> Disk Utility) and choose "New Image from folder..."

That's all.

Constantin
  • 8,721
  • 13
  • 75
  • 126
4

You might want to make a dmg disk image from the makefile/build file:

hdiutil create -srcfolder <directory> <dmg_file_name>.dmg
khachik
  • 28,112
  • 9
  • 59
  • 94
3

You can use the javapackager tool to build the you_app.app application and wrap it into an installer:

mkdir -p package/macosx
cp you_icon_app.icns package/macosx
jdk=$(/usr/libexec/java_home)
$jdk/bin/javapackager -version
$jdk/bin/javapackager -deploy -native dmg \
   -srcfiles you_app.jar -appclass you_app_name -name you_app_name \
   -outdir deploy -outfile you_app_name -v
cp deploy/bundles/you_app_name-1.0.dmg you_app_name-installer.dmg

And done.

hcarrasko
  • 2,320
  • 6
  • 33
  • 45
1

I use a maven plugin: osxappbundle-maven-plugin

Efthymis
  • 1,326
  • 11
  • 13