Excelente artigo de como criar um installer para Mac de uma aplicação Java. Como esse artigo me salvou legal, copio ele aqui, só pra não perder.
Original em: http://www.centerkey.com/mac/java/
How to Create a Mac OS X Installer for a Java Application
(Updated for Mac OS X 10.5 — Leopard)
With some simple steps you can turn your Java Swing program (.jar) into a proper Mac OS X application with a native installer. The instructions below step you through the process from scratch with a sample program called
SCREENSHOT
ICONS
↓
"It's 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.ICONS
↓
1) Install Xcode
Before continuing to the next step, it's a good idea to perform a "Software Update..." to make sure your OS files are current.
2) Launch Unix Terminal
3) Make Project Folder
mkdir ItsShowtime
cd ItsShowtime
The first command creates a folder called "ItsShowtime", and the second command moves you into the new folder.cd ItsShowtime
4) Write Some Java Code
pico ShowTime.java
Enter the following code:ShowTime.java
import java.util.Calendar; import javax.swing.*; public class ShowTime { public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setTitle("It's Showtime!"); f.getContentPane().add(new JLabel( Calendar.getInstance().getTime().toString())); f.pack(); f.setVisible(true); } }Use
5) Compile Java Program
javac ShowTime.java
ls -la
We could run the class file directly, but a class file is cumbersome. Instead we will create an executable JAR file.ls -la
6) Make Executable JAR
pico MainClass.txt
Our manifest file will only have one line:MainClass.txt
Main-Class: ShowTimeExit Pico and use the following "jar" command to create the "ShowTime.jar" file:
jar cmf MainClass.txt ShowTime.jar *.class
ls -la
Now test your executable JAR with the following command:ls -la
java -jar ShowTime.jar
The "It's Showtime!" window with the current time should display in the upper left corner of the screen. Click the red dot to exit the program.While the manual commands for steps #5 and #6 above work fine, you can automate them using Ant with this build.xml file.
7) Create Application Icon
Download and save (
Then move the file into the "ItsShowtime" folder with the following command:
mv ../Desktop/ShowTime.png .
Now we can create the icon file.Steps:
- Use "Finder" to navigate into the "Developer:Applications:Utilities" folder and double-click "Icon Composer".
- Go back to "Finder" and navigate to your "ItsShowtime" folder (which is in your home folder).
- Drag the "ShowTime.png" image file into the "128" box on the "Icon Composer" screen. When prompted about sizes, choose "Copy to all smaller sizes" and then click the "Import" button.
- Go into the "File" menu and select the "Save" option. Then deselect the "Hide extension" option and save as "ShowTime.icns".
- Quit "IconComposer".
8) Bundle the JAR
Steps:
- For the "Main Class:", use the "Choose..." button and go to and choose "ShowTime.jar".
- Check the "Use Macintosh Menu Bar" option.
- Use the "Choose Icon..." button to choose the "SnapBackup.icns" file (you'll need to navigate to the very top-level folder and then into the "Users" folder and your home folder to eventually find the "ItsShowtime" folder).
- Click the "Properties" tab and enter "1.0" into the "Version:" field.
- Also enter "1.0" into the "Get-Info String:" filed.
- Click the "Create Application..." button.
- Navigate into the "ItsShowtime" folder.
- In the "File:" field, enter "Show Time".
- Click the "Create" button.
- Quit "Jar Bundler".
9) Create Mac Installer
Steps:
- In the "Organization:" field on the "Install Properties" window, enter "com.centerkey". Then click "OK".
- In the "Title:" field enter "Show Time".
- Go to the "Project" menu and select "Add Contents...". Navigate to "ItsShowtime" folder and select "Show Time".
- Click on the "Contents" tab. Check the "Include root in package" option and click the "Apply Recommendations" button.
- Now click the "Build" (hammer) button. In the "Save As:" field, enter "ShowTimeInstaller.pkg". Click the "Save" button and then the "Return" button.
- Go to the "File" menu and select "Save". In the "Save As:" field, enter "ShowTime.pmdoc" and then click "Save".
- Quit "PackageMaker".