Jar To Mac App

Note: we recommend to have a proper knowledge of OSX and Java. We’re not going to explain how to do certain things, because the article would be too long.

This wikiHow teaches you how to open and run executable JAR files on a Windows or Mac computer. JAR (Java Archive) files contain data to be used with the Java program. Most JAR files are simply containers for data that another program needs to run with Java; therefore you cannot run these files and nothing will happen when you double-click them. Launch AppleScript editor. Write the following: -do shell script 'java -jar /Contents/execute.jar'. I commented that line out because we have yet to put the jar there. Save as application. Now Right click on produces.app file - Show Package Contents, go to Contents and drag the.jar file there. ‎Translate from Human to Gunganese. Gungan Basic, also called Gunganese, was the language spoken by the Gungans of the planet Naboo. In Gunganese most one-syllable words pertaining to the self would contain a suffix of -sa, for example, 'We-sa' and 'You-sa'. Many one-syllable words ending in a conson. We need the following tools: App Bundler: that’s going to convert our jar to app. You have to download it, compile and pack it with ant. You must do it in Mac, not Windows. JRE or JDK: you need Java in your computer.

One of the most difficult tasks while developing Crazy Belts has been setting the game to OSX. There is little information and very few tools to do it; in fact, only one tool available to pack a jar file into an app. This was a mandatory step to publish our game inside and outside OSX App Store. In Jemchicomac, we used two process for this:

  • Gatekeeper: to publish outside the store
  • Sandbox: to publish inside the store

Gatekeeper prevents third party apps to be run in the system without Apple’s signature and verification. It’s conceived for those apps that come from another stores or websites not related to the App Store. User can disable Gatekeeper, but we consider that’s fair to demonstrate you’re a valid partner of Apple and you app is trustworthy.

About JAR Files. Our goal is to help you understand what a file with a.jar suffix is and how to open it. The Java Archive file type, file format description, and Mac, Windows, Linux, and Android programs listed on this page have been individually researched and verified by the FileInfo team. Hi guys, I'm working for a client for which I developed a simple java application (I packed it in a.jar) but he doesn't want to launch it using terminal (java -jar jarname.jar). I know a couple of tools which run on mac only which can automate the task of making a mac executable app from a.jar file but I don't own a mac or have anyone handy.

On the other hand, Sandbox is a tool that encapsulates you app and check it: if it’s harmful, then Sandbox aparts it from the rest of the operative system. This is an essential requirement to publish in the Mac Store and it has a different signature than Gatekeeper.

Before all of this, as you have imagined, it’s necessary to convert our jar in an app, whatever our commercial goal in OSX is. We need the following tools:

  • App Bundler: https://bitbucket.org/infinitekind/appbundler, that’s going to convert our jar to app. You have to download it, compile and pack it with ant. You must do it in Mac, not Windows.
Jarmac parts
  • JRE or JDK: you need Java in your computer. It doesn’t have to be Oracle’s Java Virtual Machine, but it’s the one we used.
  • Mac Developer account: essential to sign the app.

Given those ingredients, we can start creating our app. We need Java 7 (in our OSX system, we find only Java 6 as preinstalled). Once we install our JVM with Java 7, we must go to one of the jdk or jre installations. For instance: …/home/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk. We click on the icon, and if the active version of Java is SE6 we have to disable it , and check SE7.

Now you have to configure Java Home: http://www.mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/

Once all of this is done, we’re ready for the next step. We create a folder with all necessary thing to build our app (I called mine “build”).

  • A build.xml file with the information for Ant of Java to create our app
  • An empty info.plist file. We just create a file called this.
  • A folder containing appbundler -1.0ea.jar.
  • A dist folder with the jar file we want to convert.
  • Optionally, a icns file that we have previously worked in and contains a whole family of icons with different sizes, to embellish the app file.

Before going on, we have to warn you that all this work is made with the Terminal and we have to go to each directory when required. For instance, if my build folder is at the Desktop, in the Terminal I must go using

[bash]cd desktop/build.[/bash]

For me, build.xml is like this:

[xml]<?xml version='1.0' encoding='UTF-8'?>

<project name='CrazyBelts' default='default' basedir='.'>

<target name='bundle'>

<taskdef name='bundleapp'

classpath='lib/appbundler-1.0ea.jar'

classname='com.oracle.appbundler.AppBundlerTask'/>

<bundleapp

outputdirectory='dist'

name='Crazy Belts'

displayname='Crazy Belts'

identifier='com.company.crazybelts'

shortversion='1.3.0'

version='1.3.0'

icon='icon.icns'

mainclassname='org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader'

copyright='2014 Company'

applicationCategory='public.app-category.puzzle-games'>

<classpath file='dist/CrazyBelts12FINAL.jar'/>

<runtime/>

<!– Workaround since the icon parameter for bundleapp doesn’t work –>

<option value='-Xdock:icon=Contents/Resources/${bundle.icon}'/>

<arch name='x86_64'/>

<arch name='i386'/>

</bundleapp>

</target>

</project>[/xml]

Let’see each entry:

[xml]<project name='CrazyBelts' default='default' basedir='.'>[/xml]

We must change the name to our app name.

[xml]<target name='bundle'>[/xml]

This is the name of our Ant task, meaning this is the one we should use when calling for Ant. In our example, once we’re set in the directory we type:

[bash]ant bundle[/bash]

Taskdef must match the label of the task we want to run. In classpath we type the directory where the AppBundler is located. Finally, we leave classname without changes.

[xml]<bundleapp

outputdirectory='dist'

name='Crazy Belts'

displayname='Crazy Belts'

identifier='com.company.crazybelts'

shortversion='1.3.0'

Jar To App Mac Os X

version='1.3.0'

icon='icon.icns'

mainclassname='org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader'

copyright='2014 Company'

applicationCategory='public.app-category.puzzle-games'>[/xml]

The main block of build.xml:

App
  • Output directory: we can put here the jar to pack (in our case, we did this), and it’ll also contain the app when it’s created.
  • name: the name of the app
  • display name: the name as displayed
  • identifier: it must match an App ID registered in your Mac Developer account. This registration can be done afterwards, and it’s only necessary if you’re going to distribute in the Mac Store, not for third parties.
  • Shortversion: the game version
  • Icon: this is the icon we mentioned before, in the root of the build folder.
  • Mainclassname: this is a very important entry. We must indicate the class that runs the app. In our case, we used Eclipse and we did spend so much time setting the main class of the app, while this IDE actually used his own Leader class when creating the exe jar.
  • Copyright: our national copyright
  • applicationCategory: our app category code. Visit this link to know more about it: https://developer.apple.com/library/Mac/releasenotes/General/SubmittingToMacAppStore/#//apple_ref/doc/uid/TP40010572-CH16-SW8
[xml]<runtime/>

<!– Workaround since the icon parameter for bundleapp doesn’t work –>

<option value='-Xdock:icon=Contents/Resources/${bundle.icon}'/>

<arch name='x86_64'/>

<arch name='i386'/>[/xml]

Only runtime.dir is important for us, we don’t touch the rest. This entry is optional and if we don’t include it in our app it won’t have an embedded jdk. Good news are that doesn’t require much space; bad news are that if the user doesn’t have the correct jdk or jre, the app won’t run, so it’s poorly advisable. This includes the path where our jdk is located; if we don’t know it and we’re using Eclipse, we can go to Preferences and check the jre.

After that, we must go to the Terminal and type:

[bash]ant bundle.[/bash]

A package with .app extension will be created, and it will contain our .jar

The final part is signing the app. In our example, we must use another way apart from Xcode. Everything will be done using Terminal.

We’re going to start with the Gatekeeper version, the easier one. To sign an app and be accepted by this technology we must create a certificate with a Team Agent account. Be very careful with this: to publish outside the App Store you must create a Developer ID Application Certificate or Developer ID Installer Certificate, depending on whether we want to only sign the app as it is or to pack it into an installer (that also has to be signed).

To create a certificate, we always have to go to the development console in the section “Certificates, Identifiers & Profiles”. Once created and added to the Keychain (check carefully we have the private key associated to the public one), we just set into the app directory and type:

[bash]codesign -v -f -s 'Developer ID Application' 'myapp.app'[/bash]

If we get an error message, we type the following command: export CODESIGN_ALLOCATE=”/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate”

And if everything goes right, we must see this: signed bundle with Mach-O universal (i386 x86_64) [com.company.myapp]

I am struggling to make a Mac App Bundle from my Java Jar file. I was told a few weeks ago that the only way to sign my Java application (Jar) to work on the latest OSX release was to join Apple Developer, build an App Bundle from my Jar. And get a certificate from Apple to install. Aquiring the certificate is the easy part.


What I can't figure out is how to build the Bundle and Apple's instructions are so out of date it's frustrating. (At least 10 years old.) It seems I JarBundler App is no longer distributed from Apple. There is some mysterious instructions to make the Bundle in Xode descirbed on one help page but I can't even figure out where to start. (I haven't written a development level code on Mac's in years.) I can find 3rd party jarbundler application that can be run through ant, but I can't get any of the example code to run. I could make the Bundle by hand but that will be difficult to mantain.


Anyone have a clue? I thought I'd try on the developer forums.


Jar File To Mac App

P.S. I am using Java 8. My app not be released through the App Store. (It's a application only for our registered customers.)