I recently learned how to use the Java javapackager command to build a macOS application bundle — i.e., a regular macOS application — from a Java application. In this tutorial I’ll show how to create a Mac application bundle from a simple Java class, in this case a Java Swing class.
As I learned recently, the Mac/Java AppBundler tool is a little out of date these days, but you can still use it with Java 8 and MacOS 10.12 to build Mac/Java applications. One problem you can run into is getting this ugly Info.plist error:
If you’re using the Oracle AppBundler to build a Mac/MacOS application bundle from a Java application and run into this error when running Ant:
NoSuchFileException: <directory path here> Info.plist
I have found that the problem is that I have not set and exported
JAVA_HOME. To set and export
JAVA_HOME on MacOS 10.12, I use this command in the shell script I use to build my Mac/Java app:
Three assumptions in this process are:
I noticed recently that a Scala/Java Swing application I am developing on Mac OS X 10.9 has blurry text when it’s run as a Mac application. The text looks fine when I run the application through SBT, but looks blurry when I package it and run it as a Mac OS X application.
A solution is to put this text in the application’s Info.plist file: