ShowTime.java MainClass.txtExcelente 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.
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
ICONS
↓ 1) Install Xcode
Apple's Xcode suite includes development tools you'll need to bundle and package a Java program. First, download Xcode for Mac Development (version 3.1.1 or later) and open the downloaded .dmgfile. Now run the "XcodeTools.mpkg" file and complete the Xcode installation with all the default options.
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
Using "Finder" go into "Applications" and then open the "Utilities" folder. Scroll down until you see "Terminal". Open "Terminal" and you're now at the Unix prompt.3) Make Project Folder
At the Unix prompt, enter these two commands:
cd ItsShowtime4) Write Some Java Code
Mac OS X comes with a simple but effective text editor called Pico. Use the following command to create and edit a new Java file:
Use 5) Compile Java Program
Back at the Unix prompt, compile your Java program into a class file:
ls -la6) Make Executable JAR
Before we make an executable JAR file, we need a manifest file to indicate which class contains the "main" function. We'll use Pico again:
Exit Pico and use the following "jar" command to create the "ShowTime.jar" file:
ls -la
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
The default icon for an executable JAR is a coffee cup. To add a custom icon, we need to use the "Icon Composer".
Download and save (
Then move the file into the "ItsShowtime" folder with the following command:
Steps:
Next we'll create a Mac application (with your new icon).8) Bundle the JAR
Using "Finder", navigate into the "Developer:Applications:Utilities" folder and double-click "Jar Bundler".
Steps:
You now have a proper Mac application. Next we'll create an installer for your application.9) Create Mac Installer
Using "Finder", navigate into the "Developer:Applications:Utilities" folder and double-click "PackageMaker".
Steps:
Your installer is done, but it's not yet download friendly.10) Put Installer on a Web Page
Before putting the installer on the web, we need to zip it up into a single file. Use "Finder" to navigate to the "ItsShowtime" folder. Create a zip of "ShowTimeInstaller.pkg" using the "Compress" option on the
Instalador para Mac de uma aplicação Java
Postado por
Felipe Nascimento
28 de julho de 2009
às
23:07
Original em: http://www.centerkey.com/mac/java/
SCREENSHOT
"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.mkdir ItsShowtime
The first command creates a folder called "ItsShowtime", and the second command moves you into the new folder.pico ShowTime.java
Enter the following code:javac ShowTime.java
We could run the class file directly, but a class file is cumbersome. Instead we will create an executable JAR file.pico MainClass.txt
Our manifest file will only have one line:jar cmf MainClass.txt ShowTime.jar *.class
Now test your executable JAR with the following command: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.mv ../Desktop/ShowTime.png .
Now we can create the icon file.
Assinar:
Postar comentários (Atom)
0 comentários:
Postar um comentário