How to create a Mac OS 10 installer for a java
application
this tutorial was tested with Mac OS 10.8.4
mountain lion. Follow the next steps and see that you can turn your Java Swing
program.jar
it to a proper Mac OS 10 application with the native installer
the next instruction step you through the process from scratch with the sample
program called Showtime
which simply displays the current time once you have successfully completed the
tutorial with the sample Java program
modify the steps to work for your Java program
let's start. step one using finder
go to applications Utilities folder
open terminal and enter the following command to see if you already have Java
installed
if needed you'll be prompted to download and install Java
step 2: make a project folder
and go to the same folder
write some java code
code go to description of this video and copied the code
use "nano" to create an editor java file
enter the following code
use control-X to exit nano, typing
yes and hit enter
step 4: compiled a Java program into a class file
step 5: make a executable jar
before we make and executable .jar file
we need a manifest file to indicate which class contains the main function
use nano again
and enter this single line of code
now use the following jar command to
create the Showtime jar file
test your execute jar with the
following command:
the whatShowtime
window with the current
time should display in the upper left corner of the screen
click the red button to exit the program
Step 6: create application icon. The default icon for an execute jar file is a
coffee cup
to add a custom icon we need to create a dot .icns file
go to description of this video, download and save the sample PNG image to your
desktop
then use the following commands to move the file into the Showtime folder
resize the image to appropriate dimensions for an icon
and converted into the dot ICNS format
this warnings from the icon utility command, just indicates
that the icon will not display optimally at some sizes
step 7: bring up spotlight with command space and open jar bundler application
next for the main class use the Choose button, then go to and choose Showtime.Jar
check the "Use Mackintosh Menu Bar" option
using finder, go to the Showtime folder and drag the Showtime
.icns file
it to the custom icon box
click the Properties tab and enter 1.0 into both, the version field
and on the, "Get info String" field
click on Create application button
navigate into the showtime folder
in the File field enter Showtime
click the Create button
quit jar Bundler
we now have a proper mac
application, next create an installer for application
step 8: create Mac installer. In terminal
use productbuild tool, to create the installer
and there it is, making a list (ls), we can see the package created
now one more thing, deleting the original application bundle
so that the installer will install into applications
instead of just over writing the original version
and it's gone
now go to finder, Showtime
folder and install Showtime application
if this video was helpful
give us a like, a comment or subscribe
to support this channel and get more of this. Thank you for viewing