tags:

views:

426

answers:

2

I have already developed a setup.exe for windows, having features like autodetecting JRE version, autoinstalling required JRE version, autostart on windows start etc. I have made this exe from a jar file(jar file was not having the above mentioned features. Features are added later when transforming a JAR to EXE. Now I was wondering if I can somehow convert exe to DMG, APP or JAR or I can add the above mentioned features in my JAR file only.) By default Mac comes with Java version 5 and my application needs minimum Java version 6 to run

A: 

Java 1.6 is not released for all macs. Mine for one does not have it there is nothing you do about it.

As for creating a dmg. In the mac os x install cd is a package called developer tools. Which includes an application called Jar Bundler that allows you to wrap jar's in to apple's .app files(exe's for mac). As for a dmg image you can create it from command line or from ant target.

Hamza Yerlikaya
+3  A: 

The normal way to distribute a Java application on a Mac is different than on Windows. You don't need a native binary to run a Java application on Mac because you can bundle it into an application (.app) file.

JarBundler, which is part of the Xcode Deveoper Tools, helps you insert your JAR file into a new .app file. You'll also specify your icon at this stage and the main class.

The app file is really just a folder. You can open the .app file as a folder by option-clicking on the application file and choosing "Show Package Contents" in the pop-up menu. Sometimes you may need to tweak the Info.plist file in the application, as there are a lot of options. There is complete documentation about the Info.plist file on the apple's developer website.

Once you have your application, you can bundle that up into a Package using PackageMaker, also part of the Xcode Developer Tools.

Further, you can bundle the package into a disk image (DMG) using DiskUtility, which you'll find in the Utilities folder.

Regarding Java versions, prior to Snow Leopard, Java 6 was only available for Intel Macs. If you require Java 6, you'll need to require that they have an Intel Mac with the latest updates or have Snow Leopard. Alternatively, you could package SoyLatte into your app to replace the native Java runtime. You'd basically be distributing a 32-bit version of Java 6 with your app.

Marcus Adams
I have used the jarBundler and it works pretty good.
Milhous